Aggregate pushdown is currently a beta feature.
Basic Usage
ParadeDB can accelerate certain styles of aggregates by pushing them down to the BM25 index. This feature is disabled by default and can be enabled by running
SET paradedb.enable_aggregate_custom_scan TO on;
With this setting enabled, queries like the following can be pushed down:
SELECT AVG(rating) FROM mock_items
WHERE id @@@ paradedb.all();
To verify that a query is pushed down, look for ParadeDB Aggregate Scan
in the EXPLAIN
output:
EXPLAIN SELECT AVG(rating) FROM mock_items
WHERE id @@@ paradedb.all();
QUERY PLAN
----------------------------------------------------------------------------------------
Custom Scan (ParadeDB Aggregate Scan) on mock_items (cost=0.00..0.00 rows=0 width=32)
Index: search_idx
Tantivy Query: {"with_index":{"query":"all"}}
Aggregate Definition: {"0":{"avg":{"field":"rating"}}}
(4 rows)
We are actively working on expanding the types of aggregates that can be pushed down. The following aggregates are currently supported:
count, sum, min/max,
average, and terms.