pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Mathieu De Zutter <mathieu@dezutter.org>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: NULLS LAST performance
Date: Wed, 23 Feb 2011 16:37:34 -0500
Message-ID: <7345.1298497054@sss.pgh.pa.us> (raw)
In-Reply-To: <AANLkTinvi12K=cK50nLiFSsCGUq3Ven0tLRW_6w2H-3E@mail.gmail.com>
References: <AANLkTimo4nrZ3_5wgMRniMoosv8eT4dZA+Buz_HCxEr_@mail.gmail.com>
	<AANLkTinvi12K=cK50nLiFSsCGUq3Ven0tLRW_6w2H-3E@mail.gmail.com>

Merlin Moncure <mmoncure@gmail.com> writes:
> you can always do this:

> create index performance_creation_date_desc_idx on
> performance(creation_date desc nulls last);

> which will index optimize your sql.  Interesting that 'null last'
> fools disallows index usage even when the index was created with
> nullls last as the default.

The problem is that his query needs to scan the index in DESC order,
which means it's effectively NULLS FIRST, which doesn't match the
requested sort order.

			regards, tom lane



view thread (8+ messages)  latest in thread

Message-ID: <7345.1298497054@sss.pgh.pa.us>
Permalink:  ../7345.1298497054@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7345.1298497054@sss.pgh.pa.us

 · 

reply

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, mmoncure@gmail.com, mathieu@dezutter.org
  Subject: Re: NULLS LAST performance
  In-Reply-To: <7345.1298497054@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