Revert "partition accounts_map_transaction_latest table (#47)"

This reverts commit 7a577a43fa.
This commit is contained in:
godmodegalactus 2024-02-01 17:56:20 +01:00
parent a065914e62
commit 99427a9253
No known key found for this signature in database
GPG Key ID: 22DA4A30887FDA3C
1 changed files with 5 additions and 20 deletions

View File

@ -127,26 +127,11 @@ CLUSTER banking_stage_results_2.transactions using transactions_pkey;
CLUSTER banking_stage_results_2.accounts using accounts_pkey;
CREATE TABLE banking_stage_results_2.accounts_map_transaction_latest_parted(
acc_id BIGINT PRIMARY KEY,
tx_ids BIGINT[]
) PARTITION BY HASH (acc_id);
DO $$
DECLARE part_no integer;
DECLARE num_parts integer := 4;
BEGIN
for part_no in 0..num_parts-1 loop
EXECUTE format(
'
CREATE TABLE banking_stage_results_2.accounts_map_transaction_latest_part%s
PARTITION OF banking_stage_results_2.accounts_map_transaction_latest_parted
FOR VALUES WITH (MODULUS %s, REMAINDER %s)
WITH (FILLFACTOR=80)
', part_no, num_parts, part_no);
end loop;
END; $$;
ALTER TABLE banking_stage_results_2.accounts_map_transaction_latest_parted RENAME TO accounts_map_transaction_latest;
CREATE TABLE banking_stage_results_2.accounts_map_transaction_latest(
acc_id BIGINT PRIMARY KEY,
-- sorted: oldest to latest, max 1000
tx_ids BIGINT[]
);
CREATE OR REPLACE FUNCTION array_dedup_append(base bigint[], append bigint[], n_limit int)
RETURNS bigint[]