diff --git a/services/horizon/internal/db2/schema/bindata.go b/services/horizon/internal/db2/schema/bindata.go index 03b8dfad3a..46dc3ba3c3 100644 --- a/services/horizon/internal/db2/schema/bindata.go +++ b/services/horizon/internal/db2/schema/bindata.go @@ -61,7 +61,7 @@ // migrations/62_claimable_balance_claimants.sql (1.428kB) // migrations/63_add_contract_id_to_asset_stats.sql (153B) // migrations/64_add_payment_flag_history_ops.sql (300B) -// migrations/65_remove_unused_indexes.sql (2.677kB) +// migrations/65_remove_unused_indexes.sql (2.897kB) // migrations/6_create_assets_table.sql (366B) // migrations/7_modify_trades_table.sql (2.303kB) // migrations/8_add_aggregators.sql (907B) @@ -1355,7 +1355,7 @@ func migrations64_add_payment_flag_history_opsSql() (*asset, error) { return a, nil } -var _migrations65_remove_unused_indexesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x55\x4d\x73\x9b\x30\x10\xbd\xfb\x57\x68\x72\x89\x3d\x8d\x4f\xb9\x25\xd3\xcc\xb4\x35\x6d\x7d\x71\x5a\x7f\x4c\x73\xd3\x08\xb4\x36\x6a\x40\xcb\x48\x4b\x1a\xff\xfb\x0e\x06\x3b\xe2\x43\x60\x6e\x0c\x7a\xef\xed\xf2\x56\xfb\x98\xcf\xd9\xa7\x54\x1d\x8c\x20\x60\xbb\x8c\x69\x24\x23\xb4\x15\x11\x29\xd4\x93\xc9\x62\xfd\xfc\x8b\x2d\x57\x8b\xe0\x85\x2d\xbf\xb3\xe0\x65\xb9\xd9\x6e\x98\x88\x22\xcc\x35\x59\x1e\x63\x0a\x5c\x62\x2a\x94\x7e\x1c\x80\x2a\xbd\x4f\x44\xa1\xc9\x25\x58\x52\xfa\xf4\xec\x23\x59\x0b\xc4\xc3\x23\x57\xd6\xe6\x60\x3c\xa8\x28\x11\x2a\x15\xa1\x08\x13\xe0\xa1\x48\x84\x8e\xc0\x16\xa4\xf2\xbd\x26\xeb\xe1\xc5\x64\x24\x27\x95\x02\x4f\x10\x5f\xf3\xcc\x03\x53\x5a\xc2\x3b\x8f\x95\x25\x34\x47\x0e\xfb\x3d\x44\x64\x39\x6a\x4e\xc7\x0c\xae\xe2\x24\x20\x0f\x60\x4e\x9c\x28\x41\x0b\x92\x0b\x1a\x4b\x54\x69\x86\x86\xc0\xf0\x37\x30\xd6\xef\x98\x97\x5f\x3e\xf2\x58\xd8\x78\x2c\x35\x33\xf0\xa6\x30\xb7\xa3\x35\x30\x03\x53\x8e\xba\x1a\x91\x3b\xa0\xe2\x9b\xa4\x6f\x34\x1e\x9d\x71\xb6\x3b\xf7\x77\x74\x03\x64\x84\x84\xcb\xb0\xc3\x23\x47\x23\xc1\xf0\x10\xf1\xd5\xcb\xc8\x2d\xf1\x44\xe9\xf2\xf2\x9d\x6f\xec\xc4\x5d\xab\x05\xfe\xd3\x93\x6f\xeb\xe0\xcb\x36\xa8\xf8\x5d\x1b\xc4\x9e\x57\x97\xf7\x6c\xb7\x59\xae\x7e\xb0\xaf\xdb\x75\x10\x4c\x1d\xcc\xec\xd1\xa3\xd3\xb9\x5e\x5e\xc5\x4e\x74\x4b\xbb\xbe\x85\x85\xd8\xd9\xe2\xd3\xd1\x59\x32\x24\x03\xc0\xa6\x25\xbc\xc4\x36\xa5\x06\x57\xb5\x10\x6f\xcf\xaa\x2a\x70\x50\x7a\xfa\x81\xfc\x6b\x51\x87\x3c\x13\x14\x73\xcc\x6c\xb3\x52\x73\xb9\xdd\xae\x4f\xc3\xad\x1b\x51\x5d\xed\xcb\x7a\x36\xe5\x7a\x43\xc0\xd5\xae\x8e\xea\x96\x14\xa0\x7e\xc5\xae\x88\x70\x65\xab\xf3\xba\xec\x95\xdd\xf6\xa4\xc8\x60\x89\x26\xe1\xa3\xd2\x6e\xb5\xfc\xbd\x1b\x2c\xe8\x44\xc6\x60\x2d\x07\x3b\xb6\x4c\x57\x44\x0d\xd6\xeb\x22\x79\x0a\xdf\x8c\x0e\xb6\x1b\xb7\x7c\x1f\xbe\xde\x53\x9b\xa1\x24\xbb\xbb\x08\xb5\xe8\x5c\xc9\xfe\xe1\xb7\xb3\xb3\xb3\xb1\xde\x0b\xdb\x67\xc5\x55\x21\x7b\xd3\xd8\xbe\x1e\x46\xb7\x1d\x2e\x67\xb4\x21\x3d\x59\x3e\xb8\xb9\xd3\xa9\x04\x12\x2a\xb1\x6c\xfe\xf4\xc4\x6e\x2d\x26\xb2\x0c\xbd\x93\x95\xb7\x0f\x0f\x04\xef\x34\x9b\xdd\x31\x3f\x30\x42\x79\x1d\xb0\x8c\x4c\x3f\x34\xc4\xfc\x10\xd3\x55\xe5\x6b\xd0\xfe\x06\x6a\xd0\x46\x0b\x33\xf6\xe7\x67\xb0\x0e\xca\xfb\xc0\x3e\xb3\xfb\xfb\xb6\xb7\x1d\x7f\xbd\xc2\x55\xe7\xa0\x16\xb4\x8d\xbf\xc3\xff\x00\x00\x00\xff\xff\x2f\x94\xb5\xbb\x75\x0a\x00\x00") +var _migrations65_remove_unused_indexesSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x55\xc9\x6e\xdb\x30\x10\xbd\xe7\x2b\x78\x8b\x8d\xc6\xa7\xdc\x12\x34\x40\x5b\xab\xad\x2f\x76\xeb\x05\xcd\x8d\xa0\xc4\xb1\xc5\x46\xe2\x08\xe4\x28\x8d\xff\xbe\x90\xe5\x85\x92\x45\x2d\xc9\x4d\x10\xdf\x9b\x37\x9c\xe5\x71\x32\x61\x9f\x52\xb5\x33\x82\x80\x6d\x32\xa6\x91\x8c\xd0\x56\x44\xa4\x50\xdf\xdc\x4c\x97\x8b\x5f\x6c\x36\x9f\x06\xcf\x6c\xf6\x9d\x05\xcf\xb3\xd5\x7a\xc5\x44\x14\x61\xae\xc9\xf2\x18\x53\xe0\x12\x53\xa1\xf4\x63\x07\x54\xe9\x6d\x22\x8a\x98\x5c\x82\x25\xa5\x0f\xdf\x3e\x92\xb5\x40\x3c\xdc\x73\x65\x6d\x0e\xc6\x83\x8a\x12\xa1\x52\x11\x8a\x30\x01\x1e\x8a\x44\xe8\x08\x6c\x41\x2a\xff\x6b\xb2\x1e\x5e\x4c\x46\x72\x52\x29\xf0\x04\xf1\x25\xcf\x3c\x30\xa5\x25\xbc\xf1\x58\x59\x42\xb3\xe7\xb0\xdd\x42\x44\x96\xa3\xe6\xb4\xcf\xa0\x17\x27\x01\xb9\x03\x73\xe0\x44\x09\x5a\x90\x5c\xd0\x50\xa2\x4a\x33\x34\x04\x86\xbf\x82\xb1\xfe\x8a\x79\xf9\xe5\x27\x8f\x85\x8d\x87\x52\x33\x03\xaf\x0a\x73\x3b\x38\x06\x66\x60\xca\x56\x1f\x5b\xe4\x36\xa8\xb8\x93\xf4\xb5\xc6\x13\x67\x58\xd9\x9d\xf9\x1d\x9c\x00\x19\x21\xe1\xdc\xec\x70\xcf\xd1\x48\x30\x3c\x44\x7c\xf1\x32\x72\x4b\x3c\x51\xba\x1c\xbe\xd3\xc4\xde\xb8\x6b\x35\xc5\x7f\xba\xb6\x58\xdf\x96\xc1\x97\x75\x70\x89\x36\x5f\xac\xdb\xb6\x8b\x2d\xe6\xe7\xff\x6c\xb3\x9a\xcd\x7f\xb0\xaf\xeb\x65\x10\x8c\x1c\xcc\xf8\xb1\x57\xd4\xc6\x45\xf4\xc6\x6f\x44\x77\x28\x55\xb7\xb7\x08\x7d\x6a\xcd\xe1\xe8\x24\x10\x92\x01\x60\xa3\x12\x5e\x62\xdb\x03\x77\x2e\x7c\x21\x75\xdd\xf1\xa3\xdc\x4e\xe9\xd1\x05\xf9\xd7\xa2\x0e\x79\x26\x28\xe6\x98\xd9\x76\xdd\xba\x61\xb8\x37\x3a\x0c\x4c\xb5\x64\xc7\x75\x39\xaf\x7c\x7b\xf0\x56\x9b\x71\x95\x8e\x47\xd5\xe2\x15\xa0\x21\xf1\x9b\x2c\xc9\x15\x39\x9e\x57\x45\xde\x75\x93\x16\x0f\xeb\x14\xac\x13\x2e\xba\x9b\xf9\xec\xf7\x66\xa0\xbc\x63\x5f\x9d\xca\x0e\xf6\x63\xa2\x4d\xe6\xd9\xa9\xde\x44\x7a\x47\x1a\x3d\xfc\xd7\x4d\xa5\x0d\x5e\xcd\xef\x9a\xa1\x24\xbb\x3b\x07\xba\xa2\x73\x25\x87\x8c\xcc\xb5\xdf\x37\xa6\xd9\xba\x02\xbd\x8b\xd4\xeb\x95\xa8\x6d\x7a\x0b\xa1\xb9\x50\x2e\xe7\x83\xa5\x6a\x79\x99\x3a\x5d\x62\x34\x92\x40\x42\x25\x96\x4d\x9e\x9e\xd8\xad\xc5\x44\x96\x56\x7c\x28\xf2\xed\xc3\x03\xc1\x1b\x8d\xc7\x77\xcc\x0f\x8c\x50\xf6\x03\x96\x46\xee\x87\x86\x98\xef\x62\xea\x25\x5f\x81\xb6\x27\x50\x81\xd6\x52\x18\xb3\x3f\x3f\x83\x65\x50\x4e\x0a\xfb\xcc\xee\xef\xbb\x2a\xdd\xf0\xa2\x17\x35\x76\x0e\x2a\x86\x5f\x7b\xc1\xfe\x07\x00\x00\xff\xff\x6e\x06\xca\xb9\x51\x0b\x00\x00") func migrations65_remove_unused_indexesSqlBytes() ([]byte, error) { return bindataRead( @@ -1371,7 +1371,7 @@ func migrations65_remove_unused_indexesSql() (*asset, error) { } info := bindataFileInfo{name: "migrations/65_remove_unused_indexes.sql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdd, 0xe7, 0xf8, 0x2d, 0x88, 0xc3, 0x68, 0x19, 0x88, 0x2d, 0x53, 0x15, 0x81, 0xfd, 0x55, 0xc3, 0x97, 0x87, 0xcc, 0x1, 0x3e, 0x67, 0x32, 0xc5, 0xff, 0xeb, 0x63, 0x5, 0x50, 0x4c, 0x73, 0x6a}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x99, 0x6, 0xc9, 0x3, 0x51, 0x52, 0x77, 0x87, 0x7f, 0x5, 0xe2, 0xdd, 0xd2, 0x49, 0xd0, 0xd1, 0x1b, 0x9a, 0x9, 0x2f, 0x10, 0xb7, 0x68, 0x44, 0xd1, 0x12, 0xce, 0x43, 0x50, 0x2e, 0xbd, 0xef}} return a, nil } diff --git a/services/horizon/internal/db2/schema/migrations/65_remove_unused_indexes.sql b/services/horizon/internal/db2/schema/migrations/65_remove_unused_indexes.sql index 6efd42bef3..3b9584c7ab 100644 --- a/services/horizon/internal/db2/schema/migrations/65_remove_unused_indexes.sql +++ b/services/horizon/internal/db2/schema/migrations/65_remove_unused_indexes.sql @@ -16,19 +16,19 @@ DROP INDEX IF EXISTS index_history_transaction_claimable_balances_on_ids; DROP INDEX IF EXISTS trade_effects_by_order_book; DROP INDEX IF EXISTS trust_lines_by_issuer; --- +migrate Down -CREATE INDEX accounts_home_domain ON accounts USING BTREE(home_domain); -CREATE INDEX accounts_inflation_destination ON accounts USING BTREE(inflation_destination); -CREATE INDEX asset_by_issuer ON history_assets USING btree (asset_issuer); -CREATE INDEX claimabable_balances_by_claimants ON claimable_balances USING gin(claimants jsonb_path_ops); -CREATE INDEX htrd_time_lookup ON history_trades USING BTREE(ledger_closed_at); -CREATE INDEX index_history_effects_on_type ON history_effects USING btree (type); -CREATE INDEX index_history_ledgers_on_closed_at ON history_ledgers USING btree (closed_at); -CREATE INDEX index_history_ledgers_on_importer_version ON history_ledgers USING btree (importer_version); -CREATE UNIQUE INDEX index_history_ledgers_on_ledger_hash ON history_ledgers USING btree (ledger_hash); -CREATE UNIQUE INDEX index_history_ledgers_on_previous_ledger_hash ON history_ledgers USING btree (previous_ledger_hash); -CREATE UNIQUE INDEX "index_history_operation_claimable_balances_on_ids" ON history_operation_claimable_balances USING btree (history_operation_id , history_claimable_balance_id); -CREATE INDEX index_history_operations_on_type ON history_operations USING btree (type); -CREATE UNIQUE INDEX "index_history_transaction_claimable_balances_on_ids" ON history_transaction_claimable_balances USING btree (history_transaction_id , history_claimable_balance_id); -CREATE INDEX trade_effects_by_order_book ON history_effects USING btree (((details ->> 'sold_asset_type'::text)), ((details ->> 'sold_asset_code'::text)), ((details ->> 'sold_asset_issuer'::text)), ((details ->> 'bought_asset_type'::text)), ((details ->> 'bought_asset_code'::text)), ((details ->> 'bought_asset_issuer'::text))) WHERE (type = 33); -CREATE INDEX trust_lines_by_issuer ON trust_lines USING BTREE(asset_issuer); +-- +migrate Down notransaction +CREATE INDEX IF NOT EXISTS accounts_home_domain ON accounts USING BTREE(home_domain); +CREATE INDEX IF NOT EXISTS accounts_inflation_destination ON accounts USING BTREE(inflation_destination); +CREATE INDEX IF NOT EXISTS asset_by_issuer ON history_assets USING btree (asset_issuer); +CREATE INDEX IF NOT EXISTS claimabable_balances_by_claimants ON claimable_balances USING gin(claimants jsonb_path_ops); +CREATE INDEX IF NOT EXISTS htrd_time_lookup ON history_trades USING BTREE(ledger_closed_at); +CREATE INDEX IF NOT EXISTS index_history_effects_on_type ON history_effects USING btree (type); +CREATE INDEX IF NOT EXISTS index_history_ledgers_on_closed_at ON history_ledgers USING btree (closed_at); +CREATE INDEX IF NOT EXISTS index_history_ledgers_on_importer_version ON history_ledgers USING btree (importer_version); +CREATE UNIQUE INDEX IF NOT EXISTS index_history_ledgers_on_ledger_hash ON history_ledgers USING btree (ledger_hash); +CREATE UNIQUE INDEX IF NOT EXISTS index_history_ledgers_on_previous_ledger_hash ON history_ledgers USING btree (previous_ledger_hash); +CREATE UNIQUE INDEX IF NOT EXISTS index_history_operation_claimable_balances_on_ids ON history_operation_claimable_balances USING btree (history_operation_id , history_claimable_balance_id); +CREATE INDEX IF NOT EXISTS index_history_operations_on_type ON history_operations USING btree (type); +CREATE UNIQUE INDEX IF NOT EXISTS index_history_transaction_claimable_balances_on_ids ON history_transaction_claimable_balances USING btree (history_transaction_id , history_claimable_balance_id); +CREATE INDEX IF NOT EXISTS trade_effects_by_order_book ON history_effects USING btree (((details ->> 'sold_asset_type'::text)), ((details ->> 'sold_asset_code'::text)), ((details ->> 'sold_asset_issuer'::text)), ((details ->> 'bought_asset_type'::text)), ((details ->> 'bought_asset_code'::text)), ((details ->> 'bought_asset_issuer'::text))) WHERE (type = 33); +CREATE INDEX IF NOT EXISTS trust_lines_by_issuer ON trust_lines USING BTREE(asset_issuer);