Re: Multi-column index: Which column order - Mailing list pgsql-general

From Ron
Subject Re: Multi-column index: Which column order
Date
Msg-id 3728c419-a158-4821-d736-dbd63a79c30d@gmail.com
Whole thread Raw
In response to Re: Multi-column index: Which column order  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Multi-column index: Which column order  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
On 2/15/23 02:46, Laurenz Albe wrote:
[snip]
> Which one is best?
>> CREATE UNIQUE INDEX ix1 ON art (code, etb)
>> or
>> CREATE UNIQUE INDEX ix1 ON art (etb, code)
>>
>> (or its PRIMARY KEY equivalent)
> Both are the same.
>
> There is an old myth that says that you should use the moew selective column first
> (which would be "code"), but that is just a myth.

Only on Postgresql?

-- 
Born in Arizona, moved to Babylonia.



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: Query plan for "id IS NULL" on PK
Next
From: Laurenz Albe
Date:
Subject: Re: Multi-column index: Which column order