add postgresql index and use IN instead of many OR #4670
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
fix part of #4658 (but we'll keep that open to explore other indexes we may want to add)
add an index on
splits(index_uid)
fix #4666
use
index_uid IN (<list of index>)
instead ofindex_uid = "index1" OR index_uid = "index2" OR ...
when querying multiple index.How was this PR tested?
tested by measuring time and checking query plan on an index with a few hundred thousand splits.
SELECT * FROM "splits" WHERE "index_uid" = $1
is made ~1900x faster on that particular dataset using the index (from 5.8s to 3.1ms)selecting with a list of 1k indexes, covering almost every split, is made ~3.5x faster (from 3s to 850ms) by using
IN
over manyOR
. Execution time and query plan are not affected byIN
over a single=
when searching with a single index