Filter scanning entire table - any alternative to withIndex?
Hi - so I noticed one of my functions is using up a LOT of bandwith on reads, and I think this code is the culprit.
The thing is I need to use an OR statement to search for users where either the email address matches OR the anonId matches.
I don't think I can do this using withIndex, cos it doesn't support u.or()
The only alternative to this I can think of is to run 2 seperate queries:
1. Run a query for just email on using a withIndex("by_email")
2. Run another query for anonId using a withIndex("by_anonId")
Is that the best approach?
RIP my bandwidth for this month 😦
2 Replies
Update:
This seems to be working wonders for me:
Run a query for just email on using a withIndex("by_email")
Run another query for anonId using a withIndex("by_anonId")
you found the solution we would have suggested 🙂