Re: Partitioned Table Index Column Order - Mailing list pgsql-general

From Tom Lane
Subject Re: Partitioned Table Index Column Order
Date
Msg-id 2549783.1624491556@sss.pgh.pa.us
Whole thread Raw
In response to Re: Partitioned Table Index Column Order  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-general
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2021-Jun-23, Rumpi Gravenstein wrote:
>> As a best practice is it better to create the primary key starting or
>> ending with the partition column?

> It is not relevant from the partitioning point of view.  Other factors
> can be used to decide the column order.

See in particular the hints in

https://www.postgresql.org/docs/current/indexes-multicolumn.html

The only thing that's different about partitioned situations is that
any particular child partition might have only a few values of the
partitioning column, which'd suggest putting it last if there are
no other relevant considerations.  However, if you need a particular
column order to match query requirements, that's certainly going
to be a more important consideration.

            regards, tom lane



pgsql-general by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Is there something similar like flashback query from Oracle planned for PostgreSQL
Next
From: David Rowley
Date:
Subject: Re: Partitioned Table Index Column Order