X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1B52ED1B927 for ; Thu, 21 Aug 2003 17:48:09 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 44048-07 for ; Thu, 21 Aug 2003 17:47:40 -0300 (ADT) Received: from stamp.musicrebellion.com (stamp.musicrebellion.com [63.170.191.108]) by svr1.postgresql.org (Postfix) with ESMTP id 07EC6D1B943 for ; Thu, 21 Aug 2003 17:47:38 -0300 (ADT) Received: from guiness.musicrebellion.com ([63.170.191.112] helo=musicrebellion.com ident=kris) by stamp.musicrebellion.com with esmtp (Exim 3.35 #1 (Debian)) id 19pwLL-0000tP-00 for ; Thu, 21 Aug 2003 15:47:39 -0500 Message-ID: <3F452FEB.60902@musicrebellion.com> Date: Thu, 21 Aug 2003 15:47:39 -0500 From: Kris Kiger User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 X-Accept-Language: en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Indexing a boolean References: <4.3.2.7.2.20030528141514.03235970@mira-sjc5-5.cisco.com> <163726734.20030531182048@gorodok.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/257 X-Sequence-Number: 9978 I would appreciate it if I could get some thoughts on indexing a field with only two values? For example, I have a table with a few million rows in it. All items in this table are broken up into two categories using 'T' or 'F'. It seems logical to me that an index on this field would create two logical 'buckets', so that one could say, "I want all 'T' values", or "I want all 'F' values" and merely have to look in the appropriate bucket, rather than have to perform a sequential scan through three million items every time a request is made based on 'T' or 'F'. If I were to create an index on a char(1) field that contains only values of 'T' or 'F', would the query analyzer override the use of this index? How does Postgres address this problem and what are all of your thoughts on this issue? I appreciate the help! Kris