From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nandakumar M <m.nanda92@gmail.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query optimiser is not using 'not null' constraint when 'order by nulls last' clause is used
Date: Fri, 02 Feb 2018 10:00:16 -0500
Message-ID: <15987.1517583616@sss.pgh.pa.us> (raw)
In-Reply-To: <CANcFUu4YyAFYUYw2P=UGTJNo4TKFqSMOjnx5pi1apxiuTqeR+g@mail.gmail.com>
References: <CANcFUu63MDBXZrnGoBML551z2aA0KC3erWSeH=E-2nmyOF3rYQ@mail.gmail.com>
<1517564200.2452.10.camel@cybertec.at>
<CANcFUu4YyAFYUYw2P=UGTJNo4TKFqSMOjnx5pi1apxiuTqeR+g@mail.gmail.com>
Nandakumar M <m.nanda92@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, m.nanda92@gmail.com, laurenz.albe@cybertec.at
Subject: Re: Query optimiser is not using 'not null' constraint when 'order by nulls last' clause is used
In-Reply-To: <15987.1517583616@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox