-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding evm_chain_id, address and event_sig to data and topic indexes (#…
…12786) * Adding evm_chain_id, address and event_sig to data and topic indexes * Post review fixes * Post review fixes * Post review fixes * Post review fixes * Bumping migration script number --------- Co-authored-by: Domino Valdano <[email protected]>
- Loading branch information
1 parent
e523aa0
commit fbb705c
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
Narrowing topic, data_word indexes by adding (evm_chain_id, address, event_sig) to the index definition #db_update |
65 changes: 65 additions & 0 deletions
65
core/store/migrate/migrations/0233_log_poller_word_topic_indexes.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
-- +goose Up | ||
|
||
drop index if exists evm.evm_logs_idx_data_word_one; | ||
drop index if exists evm.evm_logs_idx_data_word_two; | ||
drop index if exists evm.evm_logs_idx_data_word_three; | ||
drop index if exists evm.evm_logs_idx_data_word_four; | ||
drop index if exists evm.evm_logs_idx_topic_two; | ||
drop index if exists evm.evm_logs_idx_topic_three; | ||
drop index if exists evm.evm_logs_idx_topic_four; | ||
|
||
create index evm_logs_idx_data_word_one | ||
on evm.logs (address, event_sig, evm_chain_id, "substring"(data, 1, 32)); | ||
|
||
create index evm_logs_idx_data_word_two | ||
on evm.logs (address, event_sig, evm_chain_id, "substring"(data, 33, 32)); | ||
|
||
create index evm_logs_idx_data_word_three | ||
on evm.logs (address, event_sig, evm_chain_id, "substring"(data, 65, 32)); | ||
|
||
create index evm_logs_idx_data_word_four | ||
on evm.logs (address, event_sig, evm_chain_id, "substring"(data, 97, 32)); | ||
|
||
create index evm_logs_idx_data_word_five | ||
on evm.logs (address, event_sig, evm_chain_id, "substring"(data, 129, 32)); | ||
|
||
create index evm_logs_idx_topic_two | ||
on evm.logs (address, event_sig, evm_chain_id, (topics[2])); | ||
|
||
create index evm_logs_idx_topic_three | ||
on evm.logs (address, event_sig, evm_chain_id, (topics[3])); | ||
|
||
create index evm_logs_idx_topic_four | ||
on evm.logs (address, event_sig, evm_chain_id, (topics[4])); | ||
|
||
-- +goose Down | ||
|
||
drop index if exists evm.evm_logs_idx_data_word_one; | ||
drop index if exists evm.evm_logs_idx_data_word_two; | ||
drop index if exists evm.evm_logs_idx_data_word_three; | ||
drop index if exists evm.evm_logs_idx_data_word_four; | ||
drop index if exists evm.evm_logs_idx_data_word_five; | ||
drop index if exists evm.evm_logs_idx_topic_two; | ||
drop index if exists evm.evm_logs_idx_topic_three; | ||
drop index if exists evm.evm_logs_idx_topic_four; | ||
|
||
create index evm_logs_idx_data_word_one | ||
on evm.logs ("substring"(data, 1, 32)); | ||
|
||
create index evm_logs_idx_data_word_two | ||
on evm.logs ("substring"(data, 33, 32)); | ||
|
||
create index evm_logs_idx_data_word_three | ||
on evm.logs ("substring"(data, 65, 32)); | ||
|
||
create index evm_logs_idx_data_word_four | ||
on evm.logs ("substring"(data, 97, 32)); | ||
|
||
create index evm_logs_idx_topic_two | ||
on evm.logs ((topics[2])); | ||
|
||
create index evm_logs_idx_topic_three | ||
on evm.logs ((topics[3])); | ||
|
||
create index evm_logs_idx_topic_four | ||
on evm.logs ((topics[4])); |