From b4b8efbd3826ac0af2d1c2e7c40fcf80a4bfba45 Mon Sep 17 00:00:00 2001
From: Daniel Baumann
+
PostgreSQL supports basic table
partitioning. This section describes why and how to implement
partitioning as part of your database design.
@@ -368,7 +368,7 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02
@@ -989,4 +991,4 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate >= DATE '2008-01-01';
painfully slow. Simulations of the intended workload are often beneficial
for optimizing the partitioning strategy. Never just assume that more
partitions are better than fewer partitions, nor vice-versa.
- 5.11. Table Partitioning
5.11. Table Partitioning
CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales);
-CREATE INDEX measurement_usls_200602_idx
+CREATE INDEX CONCURRENTLY measurement_usls_200602_idx
ON measurement_y2006m02 (unitsales);
ALTER INDEX measurement_usls_idx
ATTACH PARTITION measurement_usls_200602_idx;
@@ -449,7 +449,9 @@ ALTER INDEX measurement_city_id_logdate_key
Using
ONLY
to add or drop a constraint on only
the partitioned table is supported as long as there are no
partitions. Once partitions exist, using ONLY
- will result in an error. Instead, constraints on the partitions
+ will result in an error for any constraints other than
+ UNIQUE
and PRIMARY KEY
.
+ Instead, constraints on the partitions
themselves can be added and (if they are not present in the parent
table) dropped.