Skip to content

Commit

Permalink
perf(graphql sqlite): always order by the first tags table PE-2395
Browse files Browse the repository at this point in the history
The first tags table is intended to be the most selective table so we
should always order by it.
  • Loading branch information
djwhitt committed May 9, 2023
1 parent 5907d37 commit 10f274c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/database/standalone-sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,9 @@ export class StandaloneSqliteDatabaseWorker {
const tagAlias = `"${index}_${index}"`;
let joinCond: { [key: string]: string };
if (source === 'stable') {
heightSortTableAlias = tagAlias;
blockTransactionIndexSortTableAlias = tagAlias;
if (index === 0 || !HIGH_CARDINALITY_TAG_NAMES.has(tag.name)) {
heightSortTableAlias = tagAlias;
blockTransactionIndexSortTableAlias = tagAlias;
joinCond = {
[`${blockTransactionIndexTableAlias}.block_transaction_index`]: `${tagAlias}.block_transaction_index`,
[`${heightTableAlias}.height`]: `${tagAlias}.height`,
Expand Down

0 comments on commit 10f274c

Please sign in to comment.