Re: Query optimiser is not using 'not null' constraint when 'order by nulls last' clause is used

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nandakumar M <m(dot)nanda92(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Query optimiser is not using 'not null' constraint when 'order by nulls last' clause is used
Date: 2018-02-02 15:00:16
Message-ID: 15987.1517583616@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Nandakumar M <m(dot)nanda92(at)gmail(dot)com> writes:
> The order by column has a not null constraint on it and so nulls last or
> first shouldn't make any difference.

The planner does not consider this and it doesn't really seem like
something worth expending cycles on. If you know that there won't be
nulls in the column, why are you insisting on specifying a nondefault
value of NULLS FIRST/LAST in the query?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Nandakumar M 2018-02-02 15:49:50 Re: Query optimiser is not using 'not null' constraint when 'order by nulls last' clause is used
Previous Message Nandakumar M 2018-02-02 14:04:30 Re: Query optimiser is not using 'not null' constraint when 'order by nulls last' clause is used