Re: ORDER BY and NULLs

From: Murphy Pope <pope_murphy(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: ORDER BY and NULLs
Date: 2004-10-28 16:52:31
Message-ID: ot9gd.432$j15.304@fe25.usenetserver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>> 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.

Now I'm confused... here's a quote from Bruce Momjian from Oct. 2003:

> To be specific, we do not do index NULL values in a column, but we
> easily index non-null values in the column.

And a comment from backend/access/gist/gist.c (appears a few times):

> GiST cannot index tuples with leading NULLs

So what's the story? Do GiST indexes index NULLs? Do other index types
index NULLs? Is the comment wrong or am I misreading it?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Schaber 2004-10-28 16:58:20 Re: Select Instead on a table
Previous Message Gary Stainburn 2004-10-28 15:01:59 Re: curious delay on view/where