4 ms·
This reminds me of a mongo optimization problem I faced years ago. Given the query {x:A, y:B} where x is a scalar and Y is an array, it was 40x faster to index
by inlined 7y ago
This reminds me of a mongo optimization problem I faced years ago. Given the query {x:A, y:B} where x is a scalar and Y is an array, it was 40x faster to index [x, y] than [y, x].
Both indexes will show a query plan that’s index only and will hit the same number of records. Locality of memory in that index (since Y had repeats) was hugely important.