MIN and MAX return the smallest and largest values of a column, respectively.
SELECT MIN(rating) FROM mock_items
WHERE id @@@ paradedb.all();
The field being min/maxed, in this case rating, must be indexed as fast.
By default, MIN/MAX ignore null values. Use COALESCE to include them in the final sum:
SELECT MIN(COALESCE(rating, 0)) FROM mock_items
WHERE id @@@ paradedb.all();
To verify that MIN was pushed down, look for a ParadeDB Aggregate Scan with min/max in the EXPLAIN output:
EXPLAIN SELECT MIN(rating) FROM mock_items
WHERE id @@@ paradedb.all();
Expected Response
                                      QUERY PLAN
---------------------------------------------------------------------------------------
 Custom Scan (ParadeDB Aggregate Scan) on mock_items  (cost=0.00..0.00 rows=0 width=4)
   Index: search_idx
   Tantivy Query: {"with_index":{"query":"all"}}
   Aggregate Definition: {"0":{"min":{"field":"rating"}}}
(4 rows)