diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-29 10:09:21 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-29 10:09:21 +0100 |
commit | c8480d97a17e1ab8f358dadc48e6e9b3ea17f6da (patch) | |
tree | 6368e671458533a604df6b214d5decff9bd7457f /src/exchangedb/exchange-0001.sql | |
parent | 65533e8df5ea5ebf25bd9ae04186a475057efa9e (diff) |
try to optimize aggregator queries
Diffstat (limited to 'src/exchangedb/exchange-0001.sql')
-rw-r--r-- | src/exchangedb/exchange-0001.sql | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql index 4a6c9afb..7acd6724 100644 --- a/src/exchangedb/exchange-0001.sql +++ b/src/exchangedb/exchange-0001.sql @@ -378,7 +378,7 @@ COMMENT ON COLUMN extension_details.extension_options CREATE TABLE IF NOT EXISTS deposits (deposit_serial_id BIGSERIAL PRIMARY KEY - ,shard INT8 NOT NULL DEFAULT 0 + ,shard INT8 NOT NULL ,known_coin_id INT8 NOT NULL REFERENCES known_coins (known_coin_id) ON DELETE CASCADE ,amount_with_fee_val INT8 NOT NULL ,amount_with_fee_frac INT4 NOT NULL @@ -400,7 +400,7 @@ CREATE TABLE IF NOT EXISTS deposits COMMENT ON TABLE deposits IS 'Deposits we have received and for which we need to make (aggregate) wire transfers (and manage refunds).'; COMMENT ON COLUMN deposits.shard - IS 'Used for load sharding. Should be set based on h_payto and merchant_pub. Default of 0 onlyapplies for columns migrated from a previous version without sharding support. 64-bit value because we need an *unsigned* 32-bit value.'; + IS 'Used for load sharding. Should be set based on h_payto and merchant_pub. 64-bit value because we need an *unsigned* 32-bit value.'; COMMENT ON COLUMN deposits.wire_target_serial_id IS 'Identifies the target bank account and KYC status';COMMENT ON COLUMN deposits.wire_salt IS 'Salt used when hashing the payto://-URI to get the h_wire'; @@ -423,12 +423,11 @@ COMMENT ON INDEX deposits_coin_pub_merchant_contract_index IS 'for get_deposit_for_wtid and test_deposit_done'; CREATE INDEX IF NOT EXISTS deposits_get_ready_index ON deposits - (shard - ,wire_deadline - ,refund_deadline - ,tiny + (shard ASC ,done ,extension_blocked + ,tiny + ,wire_deadline ASC ); COMMENT ON INDEX deposits_coin_pub_merchant_contract_index IS 'for deposits_get_ready'; @@ -438,7 +437,7 @@ CREATE INDEX IF NOT EXISTS deposits_iterate_matching_index ,wire_target_serial_id ,done ,extension_blocked - ,wire_deadline + ,refund_deadline ASC ); COMMENT ON INDEX deposits_iterate_matching_index IS 'for deposits_iterate_matching'; |