diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-27 14:56:22 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-27 14:56:28 +0100 |
commit | e46fb309654b82b596a2e5613dcc1c74af4366c0 (patch) | |
tree | 2273546b9cc4f262193ef7cdc831f650d62c77e6 /src/exchangedb | |
parent | 6ee13445cee3909d23b8ff3162f465835e89a2ce (diff) | |
download | exchange-e46fb309654b82b596a2e5613dcc1c74af4366c0.tar.xz |
refactor get_ready_deposits query and index to hopefully make query faster
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/exchange-0001.sql | 5 | ||||
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql index 0426dc50a..7ad0676cc 100644 --- a/src/exchangedb/exchange-0001.sql +++ b/src/exchangedb/exchange-0001.sql @@ -418,11 +418,12 @@ COMMENT ON INDEX deposits_coin_pub_merchant_contract_index CREATE INDEX IF NOT EXISTS deposits_get_ready_index ON deposits (shard + ,wire_deadline + ,refund_deadline ,tiny ,done + ,kyc_ok ,extension_blocked - ,wire_deadline - ,refund_deadline ); COMMENT ON INDEX deposits_coin_pub_merchant_contract_index IS 'for deposits_get_ready'; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 2c863a323..3591470e7 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1105,11 +1105,11 @@ prepare_statements (struct PostgresClosure *pg) " WHERE " " shard >= $2" " AND shard <= $3" + " AND wire_deadline<=$1" + " AND refund_deadline<$1" " AND tiny=FALSE" " AND done=FALSE" " AND (kyc_ok OR $4)" - " AND wire_deadline<=$1" - " AND refund_deadline<$1" " ORDER BY " " shard ASC" " ,wire_deadline ASC" |