All,
I'm on PostgreSQL 13 and have a partitioned table with a primary key.
create table t( a integer, b integer, c varchar, d .. ) partitioned by range( a );
As a best practice is it better to create the primary key starting or ending with the partition column?
e.g.
1) t_pkey primary key (a, b, c)
or
2) t_pkey primary key (b, c, a)
Neither the PostgreSQL documentation nor Google have an answer - at least as far as I could find. I see examples in the Postgres documentation that use 2) but no explanation of why that choice was made.
Does it even make a difference?
Thoughts?
--
Rumpi Gravenstein