diff --git a/hive/db/schema.py b/hive/db/schema.py
index 6ec207788467169d77f81862d13270c897dd8641..7808074d806b46fa980f79477171ccecf5439e02 100644
--- a/hive/db/schema.py
+++ b/hive/db/schema.py
@@ -590,7 +590,8 @@ def setup(db):
       "condenser_get_names_by_followers.sql",
       "condenser_get_names_by_following.sql",
       "condenser_get_names_by_reblogged.sql",
-      "condenser_get_discussions_by_comments.sql"
+      "condenser_get_discussions_by_comments.sql",
+      "condenser_get_account_reputations.sql"
 
     ]
     from os.path import dirname, realpath
diff --git a/hive/db/sql_scripts/condenser_get_account_reputations.sql b/hive/db/sql_scripts/condenser_get_account_reputations.sql
new file mode 100644
index 0000000000000000000000000000000000000000..5a9a8a33ce13bbcfe84c9052a88e7c63a29ebd42
--- /dev/null
+++ b/hive/db/sql_scripts/condenser_get_account_reputations.sql
@@ -0,0 +1,28 @@
+DROP FUNCTION IF EXISTS condenser_get_account_reputations;
+
+CREATE OR REPLACE FUNCTION condenser_get_account_reputations(
+  in _account_lower_bound VARCHAR,
+  in _without_lower_bound BOOLEAN,
+  in _limit INTEGER
+)
+RETURNS TABLE
+(
+    name hive_accounts.name%TYPE,
+    reputation hive_accounts.reputation%TYPE
+)
+AS
+$function$
+DECLARE
+
+BEGIN
+
+    RETURN QUERY SELECT
+      ha.name, ha.reputation
+    FROM hive_accounts ha
+    WHERE _without_lower_bound OR ( ha.name >= _account_lower_bound )
+    ORDER BY name
+    LIMIT _limit;
+
+END
+$function$
+language plpgsql STABLE;
diff --git a/hive/server/condenser_api/methods.py b/hive/server/condenser_api/methods.py
index 6d1a8e22dec9fe522a15e9d0ea344d4e76853264..ebde88edb669fa6f155962e0dd77d3bea13d39af 100644
--- a/hive/server/condenser_api/methods.py
+++ b/hive/server/condenser_api/methods.py
@@ -92,15 +92,8 @@ async def get_account_reputations(context, account_lower_bound: str = None, limi
 async def _get_account_reputations_impl(db, fat_node_style, account_lower_bound, limit):
     """Enumerate account reputations."""
     limit = valid_limit(limit, 1000, None)
-    seek = ''
-    if account_lower_bound:
-        seek = "WHERE name >= :start"
-
-    sql = """SELECT name, reputation
-              FROM hive_accounts %s
-           ORDER BY name
-              LIMIT :limit""" % seek
 
+    sql = "SELECT * FROM condenser_get_account_reputations( '{}', {}, {} )".format( account_lower_bound, account_lower_bound is None, limit )
     rows = await db.query_all(sql, start=account_lower_bound, limit=limit)
     if fat_node_style:
         return [dict(account=r[0], reputation=r[1]) for r in rows]