Re: Query optimiser is not using 'not null' constraint when 'order bynulls last' clause is used - Mailing list pgsql-performance

From David G. Johnston
Subject Re: Query optimiser is not using 'not null' constraint when 'order bynulls last' clause is used
Date
Msg-id CAKFQuwZsXmhUdOoyjM4muydFym1PwaLsP+bHe2nXAbMX3SUC7g@mail.gmail.com
Whole thread Raw
In response to Re: Query optimiser is not using 'not null' constraint when 'order bynulls last' clause is used  (Nandakumar M <m.nanda92@gmail.com>)
Responses Re: Query optimiser is not using 'not null' constraint when 'order bynulls last' clause is used  (Nandakumar M <m.nanda92@gmail.com>)
List pgsql-performance
On Fri, Feb 2, 2018 at 8:49 AM, Nandakumar M <m.nanda92@gmail.com> wrote:
But, for the PK column we are not in control of the index that is created.

​You probably can (I assume the nulls aspect of the index doesn't prevent PK usage), but you must add the PK to the table after creating the index and not let the system auto-generate the index for you.​


​ALTER TABLE name ADD ​PRIMARY KEY USING INDEX index_name;

David J.

pgsql-performance by date:

Previous
From: Nandakumar M
Date:
Subject: Re: Query optimiser is not using 'not null' constraint when 'order bynulls last' clause is used
Next
From: Nandakumar M
Date:
Subject: Re: Query optimiser is not using 'not null' constraint when 'order bynulls last' clause is used