X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50E768B9B49 for ; Mon, 7 Feb 2005 11:14:17 +0000 (GMT) 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 38977-06 for ; Mon, 7 Feb 2005 11:14:06 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 38AC38B9CA9 for ; Mon, 7 Feb 2005 11:14:08 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so870675wra for ; Mon, 07 Feb 2005 03:14:08 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=SgXgDbcKRgknK47ZYnz7kppmNitiPgCBLjPsCh42kgld1arZ1ba2Nn8vSyFI3Ic/mu1Z+WQTMz/7IPcMgAKSlKu6LppI8rpVQ3Hjq+TgJC6meGnZ9skYqRmchHQDyJY7AGGpTj8PP1a497v8eFX0/EiZ/+MzbX/sPWaOKMdYmCo= Received: by 10.54.37.58 with SMTP id k58mr208686wrk; Mon, 07 Feb 2005 03:14:07 -0800 (PST) Received: by 10.54.31.32 with HTTP; Mon, 7 Feb 2005 03:14:07 -0800 (PST) Message-ID: <2989532e0502070314402057cc@mail.gmail.com> Date: Mon, 7 Feb 2005 16:44:07 +0530 From: Antony Paul Reply-To: Antony Paul To: pgsql-performance@postgresql.org Subject: Re: Index not used with or condition In-Reply-To: <2989532e05020701073638ca4c@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2989532e05020701073638ca4c@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/107 X-Sequence-Number: 10436 On more investigation I found that index scan is not used if the query have a function in it like lower() and an index exist for lower() column. rgds Antony Paul On Mon, 7 Feb 2005 14:37:15 +0530, Antony Paul wrote: > Hi all, > I am facing a strange problem when I run EXPLAIN against a table > having more than 100000 records. The query have lot of OR conditions > and when parts of the query is removed it is using index. To analyse > it I created a table with a single column, inserted 100000 > records(random number) in it created index and run a query which > returns 1 record which have no or condition and it was using index. I > added an OR conditon and is using sequential scan. I set the > enable_seqscan to off. I ran the tests again and is using index scan. > So which one I have to use. Is this any bug in Explain. > > rgds > Antony Paul. >