X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CD783D1CAB9 for ; Tue, 4 May 2004 11:32:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 88484-01 for ; Tue, 4 May 2004 11:31:53 -0300 (ADT) Received: from mail.interprose.com (mail.interprose.com [208.186.79.3]) by svr1.postgresql.org (Postfix) with ESMTP id 72C16D1E28E for ; Tue, 4 May 2004 11:31:49 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.interprose.com (Postfix) with ESMTP id 823BF4CC4AC; Tue, 4 May 2004 07:31:54 -0700 (PDT) Received: from mail.interprose.com ([127.0.0.1]) by localhost (alderaan.interprose.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23427-09; Tue, 4 May 2004 07:31:43 -0700 (PDT) Received: from watto.interprose.net (watto.interprose.net [192.168.1.164]) by mail.interprose.com (Postfix) with ESMTP id 8D7994CC4F3; Tue, 4 May 2004 07:31:43 -0700 (PDT) Subject: Re: index not used for boolean From: Greg Johnson To: Gaetano Mendola Cc: pgsql-admin@postgresql.org In-Reply-To: References: Content-Type: multipart/alternative; boundary="=-WrqAqR7k8LF6FZdir/R/" Message-Id: <1083681101.24739.21.camel@watto.interprose.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 04 May 2004 07:31:42 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_FONTCOLOR_UNSAFE, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/30 X-Sequence-Number: 13346 --=-WrqAqR7k8LF6FZdir/R/ Content-Type: text/plain Content-Transfer-Encoding: 7bit I just ran into this yesterday also. I was trying select * from foo where expired IS TRUE and the index was not used, but when I switched it to expired = true it worked... Very frustrating bug.. wasted about 3 hours planning and analyzing the simple query. On Tue, 2004-05-04 at 00:04, Gaetano Mendola wrote: > Hi all, > is it normal that in a select like: > > select * from foo where expired; > > the index on expired is not used? > > If I rewrite that query: > > select * from foo where expired = true; > > then the index is used! > > I'm using postrgres 7.4.2 > > > Regards > Gaetano Mendola > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org --=-WrqAqR7k8LF6FZdir/R/ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit I just ran into this yesterday also. I was trying
select * from foo where expired IS TRUE
and the index was not used, but when I switched it to expired = true it worked... Very frustrating bug.. wasted about 3 hours planning and analyzing the simple query.

On Tue, 2004-05-04 at 00:04, Gaetano Mendola wrote:
Hi all,
is it normal that in a select like:

select * from foo where expired;

the index on expired is not used?

If I rewrite that query:

select * from foo where expired = true;

then the index is used!

I'm using postrgres 7.4.2


Regards
Gaetano Mendola

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
--=-WrqAqR7k8LF6FZdir/R/--