From f59582ab42c9e0f258cab3cc0c66a6f96c36759b Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 16 Feb 2022 14:04:57 -0600 Subject: [PATCH] indexes on receipt cid and mh_key should not be unique, as it is possible (but improbable) that two receipts can be identical --- db/migrations/00014_create_cid_indexes.sql | 4 ++-- .../00028_create_cid_indexes.sql | 4 ++-- schema.sql | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/db/migrations/00014_create_cid_indexes.sql b/db/migrations/00014_create_cid_indexes.sql index 620808c..baee002 100644 --- a/db/migrations/00014_create_cid_indexes.sql +++ b/db/migrations/00014_create_cid_indexes.sql @@ -17,8 +17,8 @@ CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst); CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src); -- receipt indexes -CREATE UNIQUE INDEX rct_leaf_cid_index ON eth.receipt_cids USING btree (leaf_cid); -CREATE UNIQUE INDEX rct_leaf_mh_index ON eth.receipt_cids USING btree (leaf_mh_key); +CREATE INDEX rct_leaf_cid_index ON eth.receipt_cids USING btree (leaf_cid); +CREATE INDEX rct_leaf_mh_index ON eth.receipt_cids USING btree (leaf_mh_key); CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract); CREATE INDEX rct_contract_hash_index ON eth.receipt_cids USING btree (contract_hash); diff --git a/db/post_batch_processing_migrations/00028_create_cid_indexes.sql b/db/post_batch_processing_migrations/00028_create_cid_indexes.sql index ef409de..dad62af 100644 --- a/db/post_batch_processing_migrations/00028_create_cid_indexes.sql +++ b/db/post_batch_processing_migrations/00028_create_cid_indexes.sql @@ -17,8 +17,8 @@ CREATE INDEX tx_dst_index ON eth.transaction_cids USING btree (dst); CREATE INDEX tx_src_index ON eth.transaction_cids USING btree (src); -- receipt indexes -CREATE UNIQUE INDEX rct_leaf_cid_index ON eth.receipt_cids USING btree (leaf_cid); -CREATE UNIQUE INDEX rct_leaf_mh_index ON eth.receipt_cids USING btree (leaf_mh_key); +CREATE INDEX rct_leaf_cid_index ON eth.receipt_cids USING btree (leaf_cid); +CREATE INDEX rct_leaf_mh_index ON eth.receipt_cids USING btree (leaf_mh_key); CREATE INDEX rct_contract_index ON eth.receipt_cids USING btree (contract); CREATE INDEX rct_contract_hash_index ON eth.receipt_cids USING btree (contract_hash); diff --git a/schema.sql b/schema.sql index df83153..7651c6c 100644 --- a/schema.sql +++ b/schema.sql @@ -626,14 +626,14 @@ CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number); -- Name: header_cid_index; Type: INDEX; Schema: eth; Owner: - -- -CREATE INDEX header_cid_index ON eth.header_cids USING btree (cid); +CREATE UNIQUE INDEX header_cid_index ON eth.header_cids USING btree (cid); -- -- Name: header_mh_index; Type: INDEX; Schema: eth; Owner: - -- -CREATE INDEX header_mh_index ON eth.header_cids USING btree (mh_key); +CREATE UNIQUE INDEX header_mh_index ON eth.header_cids USING btree (mh_key); -- @@ -815,7 +815,7 @@ CREATE INDEX timestamp_index ON eth.header_cids USING brin ("timestamp"); -- Name: tx_cid_index; Type: INDEX; Schema: eth; Owner: - -- -CREATE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid); +CREATE UNIQUE INDEX tx_cid_index ON eth.transaction_cids USING btree (cid); -- @@ -836,7 +836,7 @@ CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id); -- Name: tx_mh_index; Type: INDEX; Schema: eth; Owner: - -- -CREATE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key); +CREATE UNIQUE INDEX tx_mh_index ON eth.transaction_cids USING btree (mh_key); --