Commit e5732d97 authored by Conner Fromknecht's avatar Conner Fromknecht

feat: add btree index on teleportr deposit.txn_hash/address

This will ensure performance on queries for a specific deposit by
txn_hash/address does not degrade as the table grows.
parent a9f2f570
---
'@eth-optimism/teleportr': patch
---
Add btree index on deposit.txn_hash and deposit.address
......@@ -63,6 +63,14 @@ CREATE TABLE IF NOT EXISTS deposits (
);
`
const createDepositTxnHashIndex = `
CREATE INDEX ON deposits (txn_hash)
`
const createDepositAddressIndex = `
CREATE INDEX ON deposits (address)
`
const createDisbursementsTable = `
CREATE TABLE IF NOT EXISTS disbursements (
id INT8 NOT NULL PRIMARY KEY REFERENCES deposits(id),
......@@ -91,6 +99,8 @@ CREATE TABLE IF NOT EXISTS pending_txs (
var migrations = []string{
createDepositsTable,
createDepositTxnHashIndex,
createDepositAddressIndex,
createDisbursementsTable,
lastProcessedBlockTable,
pendingTxTable,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment