Partitioned Table Index Column Order - Mailing list pgsql-general

From Rumpi Gravenstein
Subject Partitioned Table Index Column Order
Date
Msg-id CAEpg1wCbZJCCYL0cesn00bCGdOsB0Q66_-3O=2TSwqGDiD-Zow@mail.gmail.com
Whole thread Raw
Responses Re: Partitioned Table Index Column Order  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Jerry LeVan
Date:
Subject: Re: Psql wants to use IP6 when connecting to self using tcp...
Next
From: Alvaro Herrera
Date:
Subject: Re: Partitioned Table Index Column Order