Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E55C3642207 for ; Thu, 10 Jun 2010 16:57:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 78743-07 for ; Thu, 10 Jun 2010 19:57:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og122.obsmtp.com (exprod7og122.obsmtp.com [64.18.2.22]) by mail.postgresql.org (Postfix) with SMTP id 088DD642203 for ; Thu, 10 Jun 2010 16:57:21 -0300 (ADT) Received: from source ([74.125.82.179]) by exprod7ob122.postini.com ([64.18.6.12]) with SMTP ID DSNKTBFDoOXVAtEqHHrw8098h0P+wDlXIQoT@postini.com; Thu, 10 Jun 2010 12:57:21 PDT Received: by wyb32 with SMTP id 32so283352wyb.24 for ; Thu, 10 Jun 2010 12:57:18 -0700 (PDT) Received: by 10.227.154.79 with SMTP id n15mr758709wbw.86.1276199838225; Thu, 10 Jun 2010 12:57:18 -0700 (PDT) Received: from [192.168.1.117] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id u19sm2450618wbc.20.2010.06.10.12.57.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 10 Jun 2010 12:57:17 -0700 (PDT) Message-ID: <4C11439C.3010603@enterprisedb.com> Date: Thu, 10 Jun 2010 22:57:16 +0300 From: Heikki Linnakangas Organization: EnterpriseDB User-Agent: Mozilla/5.0 (X11; U; Linux i686; fi-FI; rv:1.9.1.9) Gecko/20100515 Iceowl/1.0b1 Icedove/3.0.4 MIME-Version: 1.0 To: Craig James CC: Anne Rosset , pgsql-performance@postgresql.org Subject: Re: Need to increase performance of a query References: <4C1125F0.8090101@collab.net> <4C112B19.6080908@krogh.cc> <4C113098.5040105@collab.net> <98414706.20100610212211@erwied.eu> <4C113E2F.6000305@collab.net> <4C11413B.8080107@emolecules.com> In-Reply-To: <4C11413B.8080107@emolecules.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.2 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201006/184 X-Sequence-Number: 39040 On 10/06/10 22:47, Craig James wrote: > Postgres normally doesn't index NULL values even if the column is > indexed, so it has to do a table scan when your query includes an IS > NULL condition. That was addressed in version 8.3. 8.3 and upwards can use an index for IS NULL. I believe the NULLs were stored in the index in earlier releases too, they just couldn't be searched for. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com