Count Query Results
Analytics Query APIs
Count Query Results
Returns the number of rows a Superleap Object Query would produce, respecting the query’s LIMIT.
POST
Count Query Results
Overview
Companion endpoint to Execute: instead of returning records, it returns how many rows the query produces. The count respects the query’sLIMIT, and execution stops as soon as the limit is reached - which makes capped counting on very large objects fast.
Use it for:
- Tile counts -
SELECT DISTINCT id ... LIMIT 100001returns in a fraction of the time of a fullCOUNT(DISTINCT id)aggregate when the cap is reached. If the result equals the limit, display it as “1,00,000+”; if it is below the limit, it is already the exact count. - Existence / threshold checks - “are there at least N matching records?” without scanning everything.
DISTINCT id whenever a virtual relation appears in the query, since the join can return one row per child).
Request Body
string
required
Raw PostgreSQL
SELECT query. Include a LIMIT - it caps both the scan and the returned count.string
required
Base CRM object slug matching the query’s top-level
FROM.