Skip to content

Commit

Permalink
chore(insights): add more indexes to spped up DB
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Nov 28, 2024
1 parent f7dc3ef commit e003b26
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/insights/drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@
"when": 1732499276499,
"tag": "0016_demonic_legion",
"breakpoints": true
},
{
"idx": 17,
"version": "6",
"when": 1732832624307,
"tag": "0017_pink_maestro",
"breakpoints": true
}
]
}
10 changes: 9 additions & 1 deletion packages/insights/src/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,18 @@ export const manifestTable = sqliteTable(
timestamp: integer('timestamp', { mode: 'timestamp_ms' }).notNull(),
},
(table) => ({
publicApiKeyHashIndex: uniqueIndex('idx_manifests_apiKey_hash').on(
publicApiKeyHashIndex: index('idx_manifests_apiKey_hash').on(
table.hash,
table.publicApiKey
),
publicApiKeyHashIndex_2: index('idx_manifests_apiKey_hash_2').on(
table.publicApiKey,
table.hash
),
apiTimestamp: index('idx_manifest_api_timestamp').on(
table.publicApiKey,
table.timestamp
),
publicApiKeyIndex: index('idx_manifests_public_apiKey').on(table.publicApiKey),
hashIndex: index('idx_manifests_hash').on(table.hash),
})
Expand Down

0 comments on commit e003b26

Please sign in to comment.