PARTITION_TABLE
Forces the database to split ROS containers in the specified table that contain multiple distinct values of the partitioning expression. Only ROS containers with more than one distinct value can be split.
Syntax
PARTITION_TABLE ( '[schema.]table‑name')
Parameters
schema |
Specifies a schema. If multiple schemas are defined in the database, include the schema name. For example: myschema.thisDbObject |
table‑name |
The table to partition. |
Privileges
- Table owner
- USAGE privilege on schema
Restrictions
You cannot run PARTITION_TABLE
on a table that is an anchor table for a live aggregate projection or a Top-K projection.
Examples
The following example creates a simple table states
and partitions the data by state:
=> CREATE TABLE states (year INTEGER NOT NULL, state VARCHAR NOT NULL) PARTITION BY state; => CREATE PROJECTION states_p (state, year) AS SELECT * FROM states ORDER BY state, year UNSEGMENTED ALL NODES;
Run PARTITION_TABLE
to partition the table states
:
=> SELECT PARTITION_TABLE('states'); PARTITION_TABLE --------------------------------------------------------------------------------- Task: partition operation (Table: public.states) (Projection: public.states_p) (1 row)