Index query with "OR" statement
hello,
is there a way to optimize this query using index because "or" statement is not possible in index? this way full table data is fetched and only filtered afterwards.
5 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
wdyt of this solution https://discord.com/channels/1019350475847499849/1019350478817079338/1337963369856106537
thanks. is there a reason why index doesnt have or statement?
would make life much easier. i have tons of code where its needed
index queries look at a contiguous range of the table when sorted by the index fields. with an OR statement, it's no longer contiguous, so it's no longer a single db query. this is part of the convex philosophy to make the performance of a query obvious from how it's written; so you don't accidentally query too much data.
ok undersstand