-
Notifications
You must be signed in to change notification settings - Fork 303
Open
Labels
Description
database=> CREATE TABLE public.xyz (
id int8 NOT NULL,
sub_id int8 NOT NULL,
PRIMARY KEY (id, sub_id)
) PARTITION BY RANGE (id);
SELECT partman.create_parent(
p_parent_table := 'public.xyz',
p_control := 'id',
p_type := 'native',
p_template_table := NULL,
p_interval := '1000',
p_premake := 5
);
SELECT partman.create_sub_parent(
p_top_parent := 'public.xyz',
p_native_check := 'yes',
p_control := 'sub_id',
p_type := 'native',
p_interval := '1',
p_premake := 5,
p_start_partition := '1'
);
ERROR: relation "xyz" already exists
create_parent
---------------
t
(1 row)
WARNING: Child table public.xyz_p0 is not natively partitioned. Dropping and recreating with native partitioning
WARNING: Child table public.xyz_p1000 is not natively partitioned. Dropping and recreating with native partitioning
WARNING: Child table public.xyz_p2000 is not natively partitioned. Dropping and recreating with native partitioning
WARNING: Child table public.xyz_p3000 is not natively partitioned. Dropping and recreating with native partitioning
WARNING: Child table public.xyz_p4000 is not natively partitioned. Dropping and recreating with native partitioning
WARNING: Child table public.xyz_p5000 is not natively partitioned. Dropping and recreating with native partitioning
create_sub_parent
-------------------
t
(1 row)
database=> SELECT schemaname, tablename, pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename)) as size
FROM pg_tables
WHERE tablename LIKE '%xyz%'
ORDER BY tablename;
schemaname | tablename | size
------------+---------------------+------------
partman | template_public_xyz | 0 bytes
public | xyz | 0 bytes
public | xyz_default | 8192 bytes
public | xyz_p0 | 0 bytes
public | xyz_p0_default | 8192 bytes
public | xyz_p0_p1 | 8192 bytes
public | xyz_p0_p2 | 8192 bytes
public | xyz_p0_p3 | 8192 bytes
public | xyz_p0_p4 | 8192 bytes
public | xyz_p0_p5 | 8192 bytes
public | xyz_p0_p6 | 8192 bytes
public | xyz_p1000 | 0 bytes
public | xyz_p1000_default | 8192 bytes
public | xyz_p1000_p1000 | 8192 bytes
public | xyz_p2000 | 0 bytes
public | xyz_p2000_default | 8192 bytes
public | xyz_p2000_p2000 | 8192 bytes
public | xyz_p3000 | 0 bytes
public | xyz_p3000_default | 8192 bytes
public | xyz_p3000_p3000 | 8192 bytes
public | xyz_p4000 | 0 bytes
public | xyz_p4000_default | 8192 bytes
public | xyz_p4000_p4000 | 8192 bytes
public | xyz_p5000 | 0 bytes
public | xyz_p5000_default | 8192 bytes
public | xyz_p5000_p5000 | 8192 bytes
(26 `rows)`
Only subpartitions of the p0 partition have been created, and some incorrect subpartitions, such as p1000_p1000, have been generated for other partitions. It appears there is a dependency between the parent partition id and the subpartition id. Is it possible to make these ids independent of each other at the value level?