Skip site navigation (1) Skip section navigation (2)

Re: NULLS LAST performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Mathieu De Zutter <mathieu(at)dezutter(dot)org>, pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: NULLS LAST performance
Date: 2011-02-23 21:37:34
Message-ID: 7345.1298497054@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Merlin Moncure <mmoncure(at)gmail(dot)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

In response to

Responses

pgsql-performance by date

Next:From: Dave JohansenDate: 2011-02-24 04:10:31
Subject: Pushing IN (subquery) down through UNION ALL?
Previous:From: Greg SmithDate: 2011-02-23 21:17:16
Subject: Re: Unused indices

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group