# Bug 3040: Reductions / aggregates

- Status: open
- Project: Zero
- Creator: @aboodman
- Assignee: @arv
- Labels: zero
- Created: 2024-10-10T00:47:53Z
- Modified: 2026-07-10T13:56:48Z
- Reactions: ➕️ ×3 (omerchief, shreyansh073, snehalbaghel) · 🍒 ×6 (FredrikZeiner, Stanton-B, ewiner, omerchief, snehalbaghel, x-sss-x) · 👍️ ×44 (0xcadams, Azarattum, Butch78, FredrikZeiner, Hades32, MadeInPierre, MarkLyck, MatejFrnka, PravunathSingh, Stanton-B, TheNicholasNick, YevheniiKotyrlo, am-hades, arpadgabor, arv, asterikx, bodhihawken, buzinas, cbnsndwch, danielcompton, dolphorama, fahreziadh, grgbkr, herkulano, hexorx, ilyazolotarov, ionite-dev, isaachinman, izakfilmalter, jakobdybdahl, l0g1x, liborvanek, mariusom, mattkinnersley, nordfjord, omerchief, samohovets, sasa-djuric, tmm, tomyfalgui, typedrat, vasyaqwe, wingleeio, yotam180) · 😀 ×15 (Butch78, FredrikZeiner, Stanton-B, Wizzy645, cbnsndwch, ictnmd, izakfilmalter, jasonsilberman, lnanhkhoa, malte-j, omerchief, snehalbaghel, tomyfalgui, x-sss-x, yotam180) · 😄 ×6 (FredrikZeiner, PravunathSingh, Stanton-B, omerchief, snehalbaghel, x-sss-x)
- URL: https://bugs.rocicorp.dev/p/zero/issue/3040

## Description

For things like `count()`, `max()`, `distinct()`.

The most common case is to get a count of a query to display in the UI. For this, zbugs just does "20+".

Another need is to do correct virtual scrolling. For this, zbugs uses infinite scrolling instead.

## Comments (17)

### @cbnsndwch — 2025-04-30T13:09:21Z

Need this as of today. Of course I'll be a pain in the neck about it moving forward 😁

Reactions: ❤️ ×8 (MarkLyck, asterikx, bodhihawken, herkulano, joodaloop, knaren1234, tomyfalgui, yotam180)

### @l0g1x — 2025-06-24T16:27:26Z

any timeline update on this?

Reactions: 👆️ ×2 (MarkLyck, knaren1234)

### @Wizzy645 — 2025-06-25T08:53:50Z

This issue needs to be resolved

### @aboodman — 2025-06-25T17:58:29Z

We don't have this scheduled right now (it's not one of the immediate things we are working on).

We are aware it is needed and want to get to it, but we are focused right now on custom queries and then stabilizing the core features that Zero currently has.

The most common need for aggregates we have found is to get a count for a query and most people can workaround by just putting something like "20+" in the UI.

Hope this helps, and let me know if your use case is different or that workaround doesn't work.

### @nordfjord — 2025-06-25T19:25:09Z

The other thing this enables (particularly `distinct` queries is denormalising a bunch of tables which could improve performance in a bunch of cases where double joins are needed at the moment.

### @bodhihawken — 2025-06-30T11:50:56Z

Going to add my vote here, a bunch of our users just got over 1000+ orders in their systems and the lag trying to show counts for everything is not very 0ms anymore.

Reactions: 😢 ×1 (aboodman)

### @ruckc — 2025-07-18T16:43:35Z

Would love to see this, currently having to process the aggregates on client side which is non-ideal.

People who think they don't need SQL don't have to do aggregates in pure javascript.

Reactions: 👍️ ×1 (aboodman)

### @shreyansh073 — 2025-09-17T12:37:55Z

Much needed. I'm writing JS code to implement this currently.

### @FreQll — 2025-09-17T13:24:47Z

Need a count feature to know exact count of items so we can implement some stats. Currently it fetches around 600 items only and I think it will be unoptimized to fetch a ton of items data just for number.

### @cbnsndwch — 2025-10-31T22:45:41Z

Periodic (but gentle) bump here. Need basic aggregations badly for a user-facing dashboard UX

Ultra-willing to help implement and/or provide in-depth feedback and use case details if it will help

🥹

### @isaachinman — 2025-11-07T21:21:42Z

Really, really need "count" at least. Absolute must for almost all UX.

Reactions: 👍️ ×2 (joodaloop, malte-j)

### @cbnsndwch — 2025-11-08T07:16:13Z

started brainstorming what it would take with Copilot here:

https://github.com/cbnsndwch/rocicorp-mono/pull/1

Reactions: 👍️ ×1 (malte-j)

### @omerchief — 2026-02-24T19:07:17Z

Would be cool to get this before GTA VI

Reactions: 👍️ ×3 (FredrikZeiner, Stanton-B, ewiner)

### @YevheniiKotyrlo — 2026-04-30T10:19:24Z

would be really good to have it. it will help significantly to unlock features like pagination easily

### @yotam180 — 2026-05-24T12:17:49Z

+1 on the necessity of this feature. We need it for fast query count previews

Reactions: 👍️ ×1 (asterikx)

### @Trosterud — 2026-06-11T16:10:37Z

+1 looking forward to this

### @maksymm-wildnation — 2026-07-09T19:03:39Z

+1 
guys, is there any timeline for this?
