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 644715289D for ; Fri, 17 Jun 2005 02:42:26 -0300 (ADT) 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 08014-10 for ; Fri, 17 Jun 2005 05:42:25 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.199]) by svr1.postgresql.org (Postfix) with ESMTP id F3BA8528C5 for ; Fri, 17 Jun 2005 02:42:22 -0300 (ADT) Received: by rproxy.gmail.com with SMTP id i8so623860rne for ; Thu, 16 Jun 2005 22:42:22 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CQhBS5BXXq0rp0BRfC4H6KLg9V3Y0RjTGOXpWmsgoziYN9iwQKrwEKLNsF54ifdmIWieGEeWRNAJu5O6DwhOYQCXWgJUEisjGWI987K2eafbBh7zDqRNTKNTBsDCJGfNGyhDcyYaXbndexNc7stLbY1gwCHm5v/hVSUTJG81NOo= Received: by 10.38.101.35 with SMTP id y35mr941601rnb; Thu, 16 Jun 2005 22:42:22 -0700 (PDT) Received: by 10.38.97.37 with HTTP; Thu, 16 Jun 2005 22:42:22 -0700 (PDT) Message-ID: Date: Fri, 17 Jun 2005 00:42:22 -0500 From: Jaime Casanova Reply-To: Jaime Casanova To: "Marc G. Fournier" Subject: Re: Putting an INDEX on a boolean field? Cc: Tom Lane , pgsql-sql@postgresql.org In-Reply-To: <20050617020039.P90456@ganymede.hub.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050617011336.Q90456@ganymede.hub.org> <15887.1118983309@sss.pgh.pa.us> <20050617020039.P90456@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.134 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/215 X-Sequence-Number: 21816 On 6/17/05, Marc G. Fournier wrote: > On Fri, 17 Jun 2005, Tom Lane wrote: >=20 > > "Marc G. Fournier" writes: > >> Does that make sense? Would it ever get used? > > > > It could get used if one of the two values is far less frequent than th= e > > other. Personally I'd think about a partial index instead ... >=20 > Hrmmmm, hadn't thought of that ... wouldn't you have to build two indexes= =20 > (one for true, one for false) for this to be completely effective? unles= s=20 > you know all your queries are going to search for one, but not the other? >=20 I guess it will be effective only if you know wich value will be less frequent... on the other value a sequential scan will be a win, isn't it? --=20 regards, Jaime Casanova (DBA: DataBase Aniquilator ;)