CrymeLord
CrymeLord2mo ago

The Zen of Convex states:

The Zen of Convex states:
In general, your mutations and queries should be working with less than a few hundred records and should aim to finish in less than 100ms.
Now I'm assuming having (way, way) more data is fine, as long as indexes are used to quickly narrow down query results. I think what this statement means to say is that any additional filtering should ideally involve fewer than 100 documents. Is that the right interpretation? The wording here is slightly confusing, at least to me
3 Replies
CrymeLord
CrymeLordOP2mo ago
The Zen of Convex | Convex Developer Hub
Convex is an opinionated framework, with every element designed to pull developers into
lee
lee2mo ago
Yes, by "working with [...] records", it is referring to records that are read by the query or mutation. Records that are filtered out via .withIndex or .withSearchIndex do not count, because the query/mutation can exclude them en masse. Records that are filtered out via .filter or in JavaScript do count, because they must be read before being excluded one at a time.
lee
lee2mo ago
So you are exactly correct. I'm just pointing out a potentially surprising behavior of .filter. If you're interested in learning more about that, check out https://stack.convex.dev/complex-filters-in-convex
Using TypeScript to Write Complex Query Filters
There’s a new Convex helper to perform generic TypeScript filters, with the same performance as built-in Convex filters, and unlimited potential.

Did you find this page helpful?