Skip to content

Commit

Permalink
pindexer: dex: create indices for dex batch swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
cronokirby committed Aug 9, 2024
1 parent 77ba1ee commit 63c8929
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/bin/pindexer/src/dex/dex.sql
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ CREATE TABLE IF NOT EXISTS dex_batch_swap (
trace12_end INTEGER REFERENCES dex_trace (id),
trace21_start INTEGER REFERENCES dex_trace (id),
trace21_end INTEGER REFERENCES dex_trace (id),
pair_asset1 BYTEA NOT NULL,
pair_asset2 BYTEA NOT NULL,
asset1 BYTEA NOT NULL,
asset2 BYTEA NOT NULL,
unfilled1 Amount NOT NULL,
unfilled2 Amount NOT NULL,
delta1 Amount NOT NULL,
Expand All @@ -131,6 +131,10 @@ CREATE TABLE IF NOT EXISTS dex_batch_swap (
lambda2 Amount NOT NULL
);

CREATE INDEX ON dex_batch_swap(height);
CREATE INDEX ON dex_batch_swap(asset1, height);
CREATE INDEX ON dex_batch_swap(asset2, height);

-- Represents instances of invididual swaps into the batch.
CREATE TABLE IF NOT EXISTS dex_swap (
id SERIAL PRIMARY KEY,
Expand Down

0 comments on commit 63c8929

Please sign in to comment.