I have about a few million documents (800MB) in a collection (session consistency), default range indexes, partitioned on /id.
I run these two queries, which return same results, but the time and RUs they take are orders of magnitude different.
This takes 16K RUs and >= 30 seconds.
SELECT * FROM c WHERE ( c.Status = 'SomethingDistinctive' AND c.User != null)
This takes 40 RUs and about 1 second.
SELECT * FROM c WHERE ( c.Status = 'SomethingDistinctive' AND c.User.Email != null)
Basically, any time there is a user, it will be a user with an email.
Can someone familiar with CosmosDB or someone from Microsoft could provide some insight or guidelines? Should I be providing some extra indexes? I used query metrics on the slow query, and found the index ratio is 0, which seems to indicate the index is not used at all!
Thanks for any help!