commit d4361631fd23560c1cd5aa4d0a3458c37b22d42c
parent 55605272856e9acefaa3cebcb81acef4806752fe
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 7 Aug 2020 15:08:20 +0200
add missing indices
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql
@@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS merchant_exchange_signing_keys
,expire_date INT8 NOT NULL
,end_date INT8 NOT NULL
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64),
- UNIQUE (master_pub, exchange_pub, start_date)
+ UNIQUE (exchange_pub, start_date, master_pub)
);
COMMENT ON TABLE merchant_exchange_signing_keys
IS 'Here we store proofs of the exchange online signing keys being signed by the exchange master key';
@@ -160,6 +160,7 @@ COMMENT ON COLUMN merchant_inventory.address
COMMENT ON COLUMN merchant_inventory.next_restock
IS 'GNUnet absolute time indicating when the next restock is expected. 0 for unknown.';
+
CREATE TABLE IF NOT EXISTS merchant_inventory_locks
(product_serial BIGINT NOT NULL
REFERENCES merchant_inventory (product_serial) -- NO "ON DELETE CASCADE": locks prevent deletion!
@@ -451,6 +452,17 @@ COMMENT ON COLUMN merchant_tip_reserves.tips_committed_val
IS 'Amount of outstanding approved tips that have not been picked up';
COMMENT ON COLUMN merchant_tip_reserves.tips_picked_up_val
IS 'Total amount tips that have been picked up from this reserve';
+CREATE INDEX IF NOT EXISTS merchant_tip_reserves_by_reserve_pub_and_merchant_serial
+ ON merchant_tip_reserves
+ (reserve_pub,merchant_serial,creation_time);
+CREATE INDEX IF NOT EXISTS merchant_tip_reserves_by_merchant_serial_and_creation_time
+ ON merchant_tip_reserves
+ (merchant_serial,creation_time);
+CREATE INDEX IF NOT EXISTS merchant_tip_reserves_by_exchange_balance
+ ON merchant_tip_reserves
+ (exchange_initial_balance_val,exchange_initial_balance_frac);
+
+
CREATE TABLE IF NOT EXISTS merchant_tip_reserve_keys
(reserve_serial BIGINT NOT NULL UNIQUE