Counting rows¶
Same predicate shape as /query, but only the
predicates field is read — columns, page, page_size, limit
are all ignored. An empty body (or {}) counts every row.
Response¶
Examples¶
# Total row count.
curl -s -X POST http://localhost:8080/api/v1/datasets/accidents/count \
-H 'content-type: application/json' -d '{}'
# → {"count":7728394}
# Filtered count — same operators as /query.
curl -s -X POST http://localhost:8080/api/v1/datasets/accidents/count \
-H 'content-type: application/json' \
-d '{
"predicates": [
{ "col": "state", "op": "in", "val": ["CA","TX"] },
{ "col": "severity", "op": "gte", "val": 3 }
]
}'
# → {"count":418217}
Execution paths¶
DataFusion backend:
- No predicates on a materialised dataset → resident
num_rows(). No scan. - All
eq/inon indexed columns → length of the merged row-id list from the equality index. No scan. - Anything else, or lazy datasets →
SELECT COUNT(*) FROM … WHERE …through DataFusion / DuckDB.
This makes /count ideal for "results so far" UI badges that update
as the user adjusts filters.