aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/0002-deposits.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-02-05 19:11:47 +0100
committerChristian Grothoff <christian@grothoff.org>2023-02-05 19:11:47 +0100
commitab03ba16e9bc63eb5384e7b6b590fc029bf61152 (patch)
tree7a77a729c132f2fdb9fce0142b0bf3796e568ea1 /src/exchangedb/0002-deposits.sql
parente66087987f6c3565594dee3420f53165b85ba4fe (diff)
exchangedb: use partial index instead of materialized tables deposits_by_ready and deposits_by_matching; remove now broken code; rename benchmarks to use perf_-prefix and correspond to function they benchmark
Diffstat (limited to 'src/exchangedb/0002-deposits.sql')
-rw-r--r--src/exchangedb/0002-deposits.sql46
1 files changed, 19 insertions, 27 deletions
diff --git a/src/exchangedb/0002-deposits.sql b/src/exchangedb/0002-deposits.sql
index 92210afa3..d8afdac84 100644
--- a/src/exchangedb/0002-deposits.sql
+++ b/src/exchangedb/0002-deposits.sql
@@ -1,6 +1,6 @@
--
-- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
+-- Copyright (C) 2014--2023 Taler Systems SA
--
-- TALER is free software; you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software
@@ -116,6 +116,22 @@ BEGIN
',ADD CONSTRAINT ' || table_name || '_coin_pub_merchant_pub_h_contract_terms_key'
' UNIQUE (coin_pub, merchant_pub, h_contract_terms)'
);
+ EXECUTE FORMAT (
+ 'CREATE INDEX ' || table_name || '_by_ready '
+ 'ON ' || table_name || ' '
+ '(wire_deadline ASC'
+ ',shard ASC'
+ ',coin_pub'
+ ') WHERE NOT (done OR policy_blocked);'
+ );
+ EXECUTE FORMAT (
+ 'CREATE INDEX ' || table_name || '_for_matching '
+ 'ON ' || table_name || ' '
+ '(refund_deadline ASC'
+ ',merchant_pub'
+ ',coin_pub'
+ ') WHERE NOT (done OR policy_blocked);'
+ );
END
$$;
@@ -399,29 +415,5 @@ INSERT INTO exchange_tables
,'exchange-0002'
,'foreign'
,TRUE
- ,FALSE),
- ('deposits_by_ready'
- ,'exchange-0002'
- ,'create'
- ,TRUE
- ,TRUE),
- ('deposits_by_ready'
- ,'exchange-0002'
- ,'constrain'
- ,TRUE
- ,TRUE),
- ('deposits_for_matching'
- ,'exchange-0002'
- ,'create'
- ,TRUE
- ,TRUE),
- ('deposits_for_matching'
- ,'exchange-0002'
- ,'constrain'
- ,TRUE
- ,TRUE),
- ('deposits'
- ,'exchange-0002'
- ,'master'
- ,TRUE
- ,FALSE);
+ ,FALSE)
+ ;