---
title: Min/Max
---

`MIN` and `MAX` return the smallest and largest values of a column, respectively.

```sql
SELECT MIN(rating) FROM mock_items
WHERE id @@@ paradedb.all();
```

<Note>
  The field being min/maxed, in this case `rating`, must be indexed as
  [fast](/documentation/indexing/fast_fields).
</Note>

By default, `MIN`/`MAX` ignore null values. Use `COALESCE` to include them in the final sum:

```sql
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:

```sql
EXPLAIN SELECT MIN(rating) FROM mock_items
WHERE id @@@ paradedb.all();
```

```sql 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)
```
