From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | mailreg(at)numerixtechnology(dot)de |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: ORDER BY and NULLs |
Date: | 2004-09-19 18:37:11 |
Message-ID: | 87zn3mjeaw.fsf@stark.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
T E Schmitz <mailreg(at)numerixtechnology(dot)de> writes:
> 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."
You should just cross out that whole section. It's just flatly wrong.
I had always assumed it was just people bringing assumptions over from Oracle
where it is true. Perhaps this book is to blame for some of the confusion.
Which book is it?
Postgres indexes NULLs. It can use them for ORDER BY clauses.
Where it cannot use them is to satisfy "WHERE foo IS NULL" or "WHERE foo IS
NOT NULL" constraints though. That's an implementation detail, but it can be
worked around with partial indexes.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-09-19 19:00:08 | Re: ORDER BY and NULLs |
Previous Message | T E Schmitz | 2004-09-19 17:18:37 | Re: ORDER BY and NULLs |