summaryrefslogtreecommitdiff
path: root/src/exchangedb/exchange-0001.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-10 12:15:47 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-10 12:15:47 +0100
commitb40afe196c3c76c3df1538ff64be55de4e1dbcec (patch)
tree3d6cc7ac661d800639e01f73a4bfcc47932fd599 /src/exchangedb/exchange-0001.sql
parentca66a1d1af2412e3ad04c18150db7a259dc69b5e (diff)
downloadexchange-b40afe196c3c76c3df1538ff64be55de4e1dbcec.tar.gz
exchange-b40afe196c3c76c3df1538ff64be55de4e1dbcec.tar.bz2
exchange-b40afe196c3c76c3df1538ff64be55de4e1dbcec.zip
remove redundant old_coin_pub from link data
Diffstat (limited to 'src/exchangedb/exchange-0001.sql')
-rw-r--r--src/exchangedb/exchange-0001.sql4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql
index 8ee5d0e0..1f7e005e 100644
--- a/src/exchangedb/exchange-0001.sql
+++ b/src/exchangedb/exchange-0001.sql
@@ -341,10 +341,12 @@ COMMENT ON TABLE wire_out
CREATE TABLE IF NOT EXISTS aggregation_tracking
(aggregation_serial_id BIGSERIAL UNIQUE
,deposit_serial_id INT8 PRIMARY KEY REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE
- ,wtid_raw BYTEA CONSTRAINT wire_out_ref REFERENCES wire_out(wtid_raw) ON DELETE CASCADE DEFERRABLE
+ ,wtid_raw BYTEA CONSTRAINT wire_out_ref REFERENCES wire_out(wtid_raw) ON DELETE CASCADE DEFERRABLE
);
COMMENT ON TABLE aggregation_tracking
IS 'mapping from wire transfer identifiers (WTID) to deposits (and back)';
+COMMENT ON COLUMN aggregation_tracking.wtid_raw
+ IS 'We first create entries in the aggregation_tracking table and then finally the wire_out entry once we know the total amount. Hence the constraint must be deferrable and we cannot use a wireout_uuid here, because we do not have it when these rows are created. Changing the logic to first INSERT a dummy row into wire_out and then UPDATEing that row in the same transaction would theoretically reduce per-deposit storage costs by 5 percent (24/~460 bytes).';
CREATE INDEX IF NOT EXISTS aggregation_tracking_wtid_index
ON aggregation_tracking