From 88721d2a6efe188327cec5997b475adfdbd49162 Mon Sep 17 00:00:00 2001 From: Terry Date: Mon, 19 Jun 2023 22:25:11 +0800 Subject: [PATCH 1/3] add index for fevm tables --- schemas/v1/28_fevm_table_index.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 schemas/v1/28_fevm_table_index.go diff --git a/schemas/v1/28_fevm_table_index.go b/schemas/v1/28_fevm_table_index.go new file mode 100644 index 00000000..3eff4d79 --- /dev/null +++ b/schemas/v1/28_fevm_table_index.go @@ -0,0 +1,27 @@ +package v1 + +func init() { + patches.Register( + 28, + ` +-- fevm_block_headers +CREATE INDEX IF NOT EXISTS fevm_block_headers_height_idx ON {{ .SchemaName | default "public"}}.fevm_block_headers USING BTREE (height); +CREATE INDEX IF NOT EXISTS fevm_block_headers_hash_idx ON {{ .SchemaName | default "public"}}.fevm_block_headers USING HASH (hash); + +-- 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"); +`, + ) +} From 3c6f3f4219e3289535aa9ead368f494239384b61 Mon Sep 17 00:00:00 2001 From: Terry Date: Mon, 19 Jun 2023 23:40:24 +0800 Subject: [PATCH 2/3] remove useless index --- schemas/v1/28_fevm_table_index.go | 1 - 1 file changed, 1 deletion(-) diff --git a/schemas/v1/28_fevm_table_index.go b/schemas/v1/28_fevm_table_index.go index 3eff4d79..8653e03a 100644 --- a/schemas/v1/28_fevm_table_index.go +++ b/schemas/v1/28_fevm_table_index.go @@ -6,7 +6,6 @@ func init() { ` -- fevm_block_headers CREATE INDEX IF NOT EXISTS fevm_block_headers_height_idx ON {{ .SchemaName | default "public"}}.fevm_block_headers USING BTREE (height); -CREATE INDEX IF NOT EXISTS fevm_block_headers_hash_idx ON {{ .SchemaName | default "public"}}.fevm_block_headers USING HASH (hash); -- fevm_receipts CREATE INDEX IF NOT EXISTS fevm_receipts_height_idx ON {{ .SchemaName | default "public"}}.fevm_receipts USING BTREE (height); From 6cbb907e24cf3f9a9e38719a7dd8b626a8307815 Mon Sep 17 00:00:00 2001 From: "terry.hung" Date: Wed, 30 Aug 2023 16:38:45 +0800 Subject: [PATCH 3/3] Rename the file to fix the conflict --- schemas/v1/{28_fevm_table_index.go => 33_fevm_table_index.go} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename schemas/v1/{28_fevm_table_index.go => 33_fevm_table_index.go} (99%) diff --git a/schemas/v1/28_fevm_table_index.go b/schemas/v1/33_fevm_table_index.go similarity index 99% rename from schemas/v1/28_fevm_table_index.go rename to schemas/v1/33_fevm_table_index.go index 8653e03a..dddb4976 100644 --- a/schemas/v1/28_fevm_table_index.go +++ b/schemas/v1/33_fevm_table_index.go @@ -2,7 +2,7 @@ package v1 func init() { patches.Register( - 28, + 33, ` -- fevm_block_headers CREATE INDEX IF NOT EXISTS fevm_block_headers_height_idx ON {{ .SchemaName | default "public"}}.fevm_block_headers USING BTREE (height);