Optimize account lookup by auth-addr
#8
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.
Summary
Tracking issue: #5
This pull request adds a partial index to the CRDB schema, in order to optimize the performance of account lookups by the
auth-addr
parameter. It wasn't necessary to modify the indexer SQL query for this index to be used.Note that the index expression intentionally avoids using the expression
NOT account.deleted
, so that it can also be used when theinclude-deleted=true
parameter is passed in the REST API.The same kind of index can be created in a PostgreSQL schema, with similar results.
Tests in a local CockroachDB light indexer
deleted=true
deleted=false
Tests in a CockroachDB full indexer
This test was not possible since the full indexer was reset to sync from scratch, and at the time or writing it was syncing at round ~700k.
Tests in a PostgreSQL full indexer
Note that the index already existed in the development server.
This index will not be used when the
include-deleted=true
parameter is used. In order to be used, theAND NOT deleted
expression must be removed. However, it does work when theinclude-all
parameter is not used.deleted=false