X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 103803A4927 for ; Thu, 28 Oct 2004 18:22:27 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73509-02 for ; Thu, 28 Oct 2004 17:22:17 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 16B183A48D9 for ; Thu, 28 Oct 2004 18:22:17 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i9SHMGJ7074054 for ; Thu, 28 Oct 2004 17:22:16 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i9SGqa54063516 for pgsql-sql@postgresql.org; Thu, 28 Oct 2004 16:52:36 GMT From: Murphy Pope Subject: Re: ORDER BY and NULLs X-Newsgroups: comp.databases.postgresql.sql Reply-To: pope_murphy@hotmail.com Mail-Copies-To: pope_murphy@hotmail.com References: <011d01c49e5b$c88fdb20$2766f30a@development.greatgulfhomes.com> <414DB1AB.5080207@sympatico.ca> <414DB594.5000300@numerixtechnology.de> <19733.1095613137@sss.pgh.pa.us> <414DBF6D.8040500@numerixtechnology.de> <87zn3mjeaw.fsf@stark.xeocode.com> Lines: 30 User-Agent: KNode/0.7.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. Date: Thu, 28 Oct 2004 12:52:31 -0400 To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/214 X-Sequence-Number: 19317 >> 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?