disable and renable indexes correctly
This commit is contained in:
parent
35a1ba7218
commit
ae1a6e9d31
2
Makefile
2
Makefile
@ -57,13 +57,11 @@ rollback_to: $(GOOSE) checkmigration checkdbvars
|
||||
.PHONY: `rollback_pre_batch_set`
|
||||
rollback_pre_batch_set: $(GOOSE) checkdbvars
|
||||
$(GOOSE) -dir db/pre_batch_processing_migrations postgres "$(CONNECT_STRING)" down
|
||||
pg_dump -O -s $(CONNECT_STRING) > schema.sql
|
||||
|
||||
## Rollback post_batch_set
|
||||
.PHONY: rollback_post_batch_set
|
||||
rollback_post_batch_set: $(GOOSE) checkdbvars
|
||||
$(GOOSE) -dir db/post_batch_processing_migrations postgres "$(CONNECT_STRING)" down
|
||||
pg_dump -O -s $(CONNECT_STRING) > schema.sql
|
||||
|
||||
## Apply the next up migration
|
||||
.PHONY: migrate_up_by_one
|
||||
|
@ -1,15 +1,15 @@
|
||||
-- +goose Up
|
||||
CREATE INDEX log_mh_index_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||
CREATE INDEX header_hash_index ON eth.header_cids USING btree (block_hash);
|
||||
CREATE INDEX tx_header_hash_index ON eth.transaction_cids USING btree (header_id);
|
||||
CREATE INDEX transaction_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||
CREATE INDEX log_tx_hash_index ON eth.log_cids USING btree (rct_id);
|
||||
CREATE INDEX header_block_hash_index ON eth.header_cids USING btree (block_hash);
|
||||
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
||||
CREATE INDEX tx_tx_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||
CREATE INDEX log_cids_index ON eth.log_cids USING btree (rct_id, index);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX eth.log_tx_hash_index;
|
||||
DROP INDEX eth.transaction_hash_index;
|
||||
DROP INDEX eth.tx_header_hash_index;
|
||||
DROP INDEX eth.header_hash_index;
|
||||
DROP INDEX eth.log_cids_index;
|
||||
DROP INDEX eth.tx_tx_hash_index;
|
||||
DROP INDEX eth.tx_header_id_index;
|
||||
DROP INDEX eth.header_block_hash_index;
|
||||
DROP INDEX eth.block_number_index;
|
||||
DROP INDEX eth.log_mh_index_index;
|
||||
DROP INDEX eth.log_mh_index;
|
||||
|
@ -0,0 +1,45 @@
|
||||
-- +goose Up
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
@ -1,15 +0,0 @@
|
||||
-- +goose Up
|
||||
DROP INDEX eth.log_tx_hash_index;
|
||||
DROP INDEX eth.transaction_hash_index;
|
||||
DROP INDEX eth.tx_header_hash_index;
|
||||
DROP INDEX eth.header_hash_index;
|
||||
DROP INDEX eth.block_number_index;
|
||||
DROP INDEX eth.log_mh_index_index;
|
||||
|
||||
-- +goose Down
|
||||
CREATE INDEX log_mh_index_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||
CREATE INDEX header_hash_index ON eth.header_cids USING btree (block_hash);
|
||||
CREATE INDEX tx_header_hash_index ON eth.transaction_cids USING btree (header_id);
|
||||
CREATE INDEX transaction_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||
CREATE INDEX log_tx_hash_index ON eth.log_cids USING btree (rct_id);
|
@ -0,0 +1,48 @@
|
||||
-- +goose Up
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
||||
REINDEX TABLE eth.header_cids;
|
||||
REINDEX TABLE eth.transaction_cids;
|
||||
REINDEX TABLE eth.log_cids;
|
||||
|
||||
-- +goose Down
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
@ -1,6 +1,5 @@
|
||||
-- +goose Up
|
||||
-- header indexes
|
||||
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||
CREATE INDEX header_cid_index ON eth.header_cids USING btree (cid);
|
||||
CREATE INDEX header_mh_index ON eth.header_cids USING btree (mh_key);
|
||||
CREATE INDEX state_root_index ON eth.header_cids USING btree (state_root);
|
||||
@ -10,7 +9,6 @@ CREATE INDEX timestamp_index ON eth.header_cids USING brin (timestamp);
|
||||
CREATE INDEX uncle_header_id_index ON eth.uncle_cids USING btree (header_id);
|
||||
|
||||
-- transaction indexes
|
||||
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
||||
CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid);
|
||||
CREATE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key);
|
||||
CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst);
|
||||
@ -46,7 +44,6 @@ CREATE INDEX access_list_element_address_index ON eth.access_list_elements USING
|
||||
CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys);
|
||||
|
||||
-- log indexes
|
||||
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX log_cid_index ON eth.log_cids USING btree (leaf_cid);
|
||||
CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
|
||||
CREATE INDEX log_topic0_index ON eth.log_cids USING btree (topic0);
|
||||
@ -62,7 +59,6 @@ DROP INDEX eth.log_topic1_index;
|
||||
DROP INDEX eth.log_topic0_index;
|
||||
DROP INDEX eth.log_address_index;
|
||||
DROP INDEX eth.log_cid_index;
|
||||
DROP INDEX eth.log_mh_index;
|
||||
|
||||
-- access list indexes
|
||||
DROP INDEX eth.access_list_storage_keys_index;
|
||||
@ -98,7 +94,6 @@ DROP INDEX eth.tx_src_index;
|
||||
DROP INDEX eth.tx_dst_index;
|
||||
DROP INDEX eth.tx_mh_index;
|
||||
DROP INDEX eth.tx_cid_index;
|
||||
DROP INDEX eth.tx_header_id_index;
|
||||
|
||||
-- uncle indexes
|
||||
DROP INDEX eth.uncle_header_id_index;
|
||||
@ -108,4 +103,3 @@ DROP INDEX eth.timestamp_index;
|
||||
DROP INDEX eth.state_root_index;
|
||||
DROP INDEX eth.header_mh_index;
|
||||
DROP INDEX eth.header_cid_index;
|
||||
DROP INDEX eth.block_number_index;
|
Loading…
Reference in New Issue
Block a user