Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add index for fevm tables #1233

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions schemas/v1/33_fevm_table_index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package v1

func init() {
patches.Register(
33,
`
-- fevm_block_headers
CREATE INDEX IF NOT EXISTS fevm_block_headers_height_idx ON {{ .SchemaName | default "public"}}.fevm_block_headers USING BTREE (height);

-- fevm_receipts
CREATE INDEX IF NOT EXISTS fevm_receipts_height_idx ON {{ .SchemaName | default "public"}}.fevm_receipts USING BTREE (height);
CREATE INDEX IF NOT EXISTS fevm_receipts_from_idx ON {{ .SchemaName | default "public"}}.fevm_receipts USING HASH ("from");
CREATE INDEX IF NOT EXISTS fevm_receipts_to_idx ON {{ .SchemaName | default "public"}}.fevm_receipts USING HASH ("to");

-- fevm_contracts
CREATE INDEX IF NOT EXISTS fevm_contracts_height_idx ON {{ .SchemaName | default "public"}}.fevm_contracts USING BTREE (height);
CREATE INDEX IF NOT EXISTS fevm_contracts_actor_id_idx ON {{ .SchemaName | default "public"}}.fevm_contracts USING HASH (actor_id);
CREATE INDEX IF NOT EXISTS fevm_contracts_eth_address_idx ON {{ .SchemaName | default "public"}}.fevm_contracts USING HASH (eth_address);

-- fevm_transactions
CREATE INDEX IF NOT EXISTS fevm_transactions_height_idx ON {{ .SchemaName | default "public"}}.fevm_transactions USING BTREE (height);
CREATE INDEX IF NOT EXISTS fevm_transactions_from_idx ON {{ .SchemaName | default "public"}}.fevm_transactions USING HASH ("from");
CREATE INDEX IF NOT EXISTS fevm_transactions_to_idx ON {{ .SchemaName | default "public"}}.fevm_transactions USING HASH ("to");
`,
)
}