Re: ORDER BY and NULLs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mailreg(at)numerixtechnology(dot)de
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: ORDER BY and NULLs
Date: 2004-09-19 19:00:08
Message-ID: 20623.1095620408@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

T E Schmitz <mailreg(at)numerixtechnology(dot)de> writes:
> Tom Lane wrote:
>> Whatever you were reading had it pretty badly garbled :-(

> I just dug out the PostgreSQL book again because I thought I might've
> garbled it:

> Quote: "PostgreSQL will not index NULL values. Because an index will
> never include NULL values, it cannot be used to satisfy the ORDER BY
> clause of a query that returns all rows in a table."

[ shrug ] It's wrong on both counts, and has been since (checks CVS) 1997.
What book is that anyway?

There is a related statement that is still true: "WHERE x IS NULL"
(or NOT NULL) clauses are not indexscannable. This is a shortcoming of
the planner-to-index-access-method interface, though, not a question of
whether the index can store NULLs.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message T E Schmitz 2004-09-19 20:22:23 Re: ORDER BY and NULLs
Previous Message Greg Stark 2004-09-19 18:37:11 Re: ORDER BY and NULLs