You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Query preview materializes up to 500 rows to display one integer #2743
For a type with many matches this fetches up to 500 full node payloads — content, properties, every column — transfers them over gRPC, deserializes them, and then calls .length on the array. Every byte past the count is discarded.
It also means the count saturates: the editor renders a full page as 500+ because that is the most it can distinguish. A user filtering 50,000 tasks down to 12,000 sees 500+, which is true but not useful for judging whether the filter is doing what they meant.
Prior art
CountNodes already exists for exactly this shape — it shares QueryNodesSimpleRequest with QueryNodesSimple and returns a scalar, with a comment noting it exists so callers need not transfer records they will not use. ExecuteQuery has no such counterpart.
Proposed Solution
Add a CountQuery RPC taking ExecuteQueryRequest (or its filter subset) and returning a count, mirroring the QueryNodesSimple/CountNodes pairing. QueryService would issue SELECT COUNT(*) against the same generated WHERE clause rather than selecting ids and hydrating nodes.
Then handleQueryPreview calls it instead, and the preview reports a real total with no ceiling.
Acceptance Criteria
A count RPC exists for the ExecuteQuery filter shape, reusing QueryService's WHERE-clause generation rather than duplicating it
handleQueryPreview uses it and no longer materializes rows
The preview reports an exact total with no 500+ saturation
Sorting is not requested for a count (it cannot affect one)
Context
Surfaced in review of #2742, which routed saved queries through QueryService. Deferred there as new backend capability rather than scope of that change.
Activity
malibio commentedon Sep 17, 2026
Frontend baseline: 256 test files passed, 5214 tests passed (Duration 64.37s).