From 5b2c0a237038cff64dd3134ac8bdb538ca0c21cf Mon Sep 17 00:00:00 2001 From: peter <1674920+peterbitfly@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:28:26 +0000 Subject: [PATCH] fix(v1): add proper index for validator withdrawals query --- ...dd_validatorindex_slot_index_withdrawals_table.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrations/20241120092635_add_validatorindex_slot_index_withdrawals_table.sql diff --git a/db/migrations/20241120092635_add_validatorindex_slot_index_withdrawals_table.sql b/db/migrations/20241120092635_add_validatorindex_slot_index_withdrawals_table.sql new file mode 100644 index 0000000000..5bafa95f24 --- /dev/null +++ b/db/migrations/20241120092635_add_validatorindex_slot_index_withdrawals_table.sql @@ -0,0 +1,11 @@ +-- +goose Up +-- +goose StatementBegin +SELECT 'creating idx_blocks_withdrawals_validatorindex_slot'; +CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_blocks_withdrawals_validatorindex_slot ON blocks_withdrawals (validatorindex, block_slot DESC); +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +SELECT 'dropping idx_blocks_withdrawals_validatorindex_slot'; +DROP INDEX CONCURRENTLY IF EXISTS idx_blocks_withdrawals_validatorindex_slot; +-- +goose StatementEnd