Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ Column | Type | Nullable | Details

Indexes:
- PRIMARY KEY: btree(`uid`)
- order_cancellation_timestamp: btree(`cancellation_timestamp`)
- order_creation_timestamp: btree(`creation_timestamp`)
- order_owner: hash(`owner`)
- order_quoting_parameters: btree(`sell_token`, `buy_token`, `sell_amount`)
- order_sell_buy_tokens: btree(`sell_token`, `buy_token`)
- user_order_creation_timestamp: btree(`owner`, `creation_timestamp`)
- version_idx: btree(`settlement_contract`)

### fee_policies

Expand Down
10 changes: 10 additions & 0 deletions database/sql/V095__update_order_timestamp_indexes.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- create a separate index for cancellation_timestamp to improve queries
-- filtering based on the cancellation_timestamp
-- no extra index with only the creation_timestamp needs to be created
-- since that already exists.
CREATE INDEX order_cancellation_timestamp ON orders USING BTREE(cancellation_timestamp);

-- drop index over (creation_timestamp, cancellation timestamp)
-- since it can only be used optimally for queries on the creation_timestamp.
DROP INDEX IF EXISTS order_creation_cancellation;

Loading