-- Parent-Tabelle CREATE TABLE customers ( id BIGINT, country TEXT NOT NULL, name TEXT, -- Primary Key muss Partition Key enthalten PRIMARY KEY (id, country) ) PARTITION BY LIST (country); -- Partitionen für einzelne Länder CREATE TABLE customers_de PARTITION OF customers FOR VALUES IN ('DE'); CREATE TABLE customers_us PARTITION OF customers FOR VALUES IN ('US'); CREATE TABLE customers_fr PARTITION OF customers FOR VALUES IN ('FR'); -- Default-Partition (für alle anderen Länder) CREATE TABLE customers_default PARTITION OF customers DEFAULT; -- Optionaler Index (wird auf alle Partitionen angewendet) CREATE INDEX idx_customers_name ON customers (name); -- Testdaten INSERT INTO customers (id, country, name) VALUES (1, 'DE', 'Max'), (2, 'US', 'John'), (3, 'FR', 'Pierre'), (4, 'ES', 'Carlos'); -- landet in customers_default