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 98C38329E67 for ; Sun, 19 Sep 2004 20:00:14 +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 83401-01 for ; Sun, 19 Sep 2004 19:00:10 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1DD60329E76 for ; Sun, 19 Sep 2004 20:00:10 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i8JJ08Gd020624; Sun, 19 Sep 2004 15:00:08 -0400 (EDT) To: mailreg@numerixtechnology.de Cc: pgsql-sql@postgresql.org Subject: Re: ORDER BY and NULLs In-reply-to: <414DBF6D.8040500@numerixtechnology.de> 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> Comments: In-reply-to T E Schmitz message dated "Sun, 19 Sep 2004 18:18:37 +0100" Date: Sun, 19 Sep 2004 15:00:08 -0400 Message-ID: <20623.1095620408@sss.pgh.pa.us> From: Tom Lane 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: 200409/138 X-Sequence-Number: 18984 T E Schmitz 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