aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/partition-0001.sql
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-03-26 09:00:19 +0100
committerChristian Grothoff <grothoff@gnunet.org>2022-03-26 09:00:19 +0100
commit783e2ae424fdd338da142e2e7472ee86b27d4035 (patch)
tree19e064be30a2276f2e07988b199f3a0d95615e0e /src/exchangedb/partition-0001.sql
parent238761c87d37dd03e47e79c368d2af4ea570158d (diff)
add partitions to new p2p tables
Diffstat (limited to 'src/exchangedb/partition-0001.sql')
-rw-r--r--src/exchangedb/partition-0001.sql24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/exchangedb/partition-0001.sql b/src/exchangedb/partition-0001.sql
index 49f865db..ba326798 100644
--- a/src/exchangedb/partition-0001.sql
+++ b/src/exchangedb/partition-0001.sql
@@ -229,6 +229,28 @@ BEGIN
);
PERFORM add_constraints_to_deposits_partition(num_partitions::varchar);
+-- TODO: dynamically (!) creating/deleting deposits partitions:
+-- create new partitions 'as needed', drop old ones once the aggregator has made
+-- them empty; as 'new' deposits will always have deadlines in the future, this
+-- would basically guarantee no conflict between aggregator and exchange service!
+-- SEE also: https://www.cybertec-postgresql.com/en/automatic-partition-creation-in-postgresql/
+-- (article is slightly wrong, as this works:)
+--CREATE TABLE tab (
+-- id bigint GENERATED ALWAYS AS IDENTITY,
+-- ts timestamp NOT NULL,
+-- data text
+-- PARTITION BY LIST ((ts::date));
+-- CREATE TABLE tab_def PARTITION OF tab DEFAULT;
+-- BEGIN
+-- CREATE TABLE tab_part2 (LIKE tab);
+-- insert into tab_part2 (id,ts, data) values (5,'2022-03-21', 'foo');
+-- alter table tab attach partition tab_part2 for values in ('2022-03-21');
+-- commit;
+-- Naturally, to ensure this is actually 100% conflict-free, we'd
+-- need to create tables at the granularity of the wire/refund deadlines;
+-- that is right now configurable via AGGREGATOR_SHIFT option.
+
+
PERFORM create_table_partition(
'refunds'
,modulus
@@ -287,4 +309,4 @@ BEGIN
END
$$;
-COMMIT; \ No newline at end of file
+COMMIT;