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 B7B89329E67 for ; Sun, 19 Sep 2004 18:42:39 +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 67463-02 for ; Sun, 19 Sep 2004 17:42:35 +0000 (GMT) Received: from msgdirector1.onetel.net.uk (msgdirector1.onetel.net.uk [212.67.96.148]) by svr1.postgresql.org (Postfix) with ESMTP id 40CB0329E66 for ; Sun, 19 Sep 2004 18:42:35 +0100 (BST) Received: from bolek.coachhouse (213-78-100-13.friaco.onetel.net.uk [213.78.100.13]) by msgdirector1.onetel.net.uk (MOS 3.4.6-GR) with ESMTP id CAE70202; Sun, 19 Sep 2004 18:42:29 +0100 (BST) Received: (Exim 3.36) #1 (Debian)) protocol: esmtp id 1C95Kf-000550-00 ; Sun, 19 Sep 2004 18:18:37 +0100 Message-ID: <414DBF6D.8040500@numerixtechnology.de> Date: Sun, 19 Sep 2004 18:18:37 +0100 From: T E Schmitz Reply-To: mailreg@numerixtechnology.de User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane , pgsql-sql@postgresql.org Subject: Re: ORDER BY and NULLs References: <011d01c49e5b$c88fdb20$2766f30a@development.greatgulfhomes.com> <414DB1AB.5080207@sympatico.ca> <414DB594.5000300@numerixtechnology.de> <19733.1095613137@sss.pgh.pa.us> In-Reply-To: <19733.1095613137@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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/136 X-Sequence-Number: 18982 Hello Tom, Tom Lane wrote: > T E Schmitz writes: > >>I read somewhere that an Index is not >>going to improve the performance of an ORDER BY if the sort column >>contains NULLs because NULLs aren't indexed? > > 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." > Btree indexes *do* store nulls, so the presence of nulls doesn't affect Thank you for your explanations. At the moment the table has only 1300 entries and any query is responsive. I'm just planning ahead... -- Regards/Gruß, Tarlika Elisabeth Schmitz