Database Design
Lis Sulmont
Curriculum Manager
Tables grow (100s Gb / Tb)
Problem: queries/updates become slower
Because: e.g., indices don't fit memory
Solution: split table into smaller parts (= partitioning)
1. Conceptual data model
2. Logical data model
For partitioning, logical data model is the same
3. Physical data model
Partitioning is part of physical data model
Split table even when fully normalized
E.g., store long_description
on slower medium
CREATE TABLE sales ( ... timestamp DATE NOT NULL ) PARTITION BY RANGE (timestamp);
CREATE TABLE sales_2019_q1 PARTITION OF sales FOR VALUES FROM ('2019-01-01') TO ('2019-03-31'); ... CREATE TABLE sales_2019_q4 PARTITION OF sales FOR VALUES FROM ('2019-10-01') TO ('2020-01-31');
CREATE INDEX ON sales ('timestamp');
Pros
Cons
Database Design