pipsai
pipsai12mo ago

Convex query best practices

I didn't really index the invite codes but i did it with posts. Is it best practice to index everything?
3 Replies
erquhart
erquhart12mo ago
Filtering is great when you're first starting and just trying to get things working. You'll want to use indexes in general, but you can circle back and do that later. tried to make this a thread and failed lol
pipsai
pipsaiOP12mo ago
Yeah I already did indexing to my other functions. Is there a benefit of indexing everything? rather than being selective with what to index?
erquhart
erquhart12mo ago
I would expect to use an index for every query unless my app is simply not going to scale, and will maintain an overall small amount of data. Many indexes can be reused across multiple queries, I wouldn't worry about defining too many of them. The benefit of indexing is that a query without an index has to scan every row in a table, whereas an indexed query only has to scan the rows included in the index. Which at scale is often an orders of magnitude difference.

Did you find this page helpful?