Postgresql - partitoned tables

Moki Lv6
1
2
3
4
5
6
7
8
9
10
11
12
CREATE TABLE "tbl"
(
"id" bigint NOT NULL GENERATED ALWAYS AS IDENTITY,
"user_id" bigint NOT NULL,
"date" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

) PARTITION BY HASH (user_id);

CREATE TABLE tbl_p01 PARTITION OF tbl FOR VALUES WITH (MODULUS 4, REMAINDER 0);
CREATE TABLE tbl_p02 PARTITION OF tbl FOR VALUES WITH (MODULUS 4, REMAINDER 1);
CREATE TABLE tbl_p03 PARTITION OF tbl FOR VALUES WITH (MODULUS 4, REMAINDER 2);
CREATE TABLE tbl_p04 PARTITION OF tbl FOR VALUES WITH (MODULUS 4, REMAINDER 3);
On this page
Postgresql - partitoned tables