Do parenthesis affect the order in which filter conditions get applied in WHERE clause? Say I have thousands of documents with this schema:
{
"batchId": "<random_guid>",
"size": "<small, medium, or large>",
"details":
{
...
}
}
Right now in my collection all documents belong in one of 50 batches. Batches are further broken down by the size, so roughly 1000 documents per batch.
Therefore when querying for all documents with size small in batch x, I would like to reduce the number of documents to search, by first filtering out all of those that don't belong to batch x, and then from that subset of documents only select those that have size small.
Will this query achieve the aforementioned behavior: SELECT * FROM r WHERE ((r.batchId = 'x') AND r.size = 'small')