Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A46FEB5DC15 for ; Thu, 23 Jun 2011 12:55:57 -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 60324-09 for ; Thu, 23 Jun 2011 15:55:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 58378B5DBF1 for ; Thu, 23 Jun 2011 12:55:50 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QZmFw-00032m-W2 for pgsql-performance@postgresql.org; Thu, 23 Jun 2011 17:55:48 +0200 Received: from p5dc4fa38.dip.t-dialin.net ([93.196.250.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Jun 2011 17:55:48 +0200 Received: from shortcutter by p5dc4fa38.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Jun 2011 17:55:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Robert Klemme Subject: Re: bitmask index Date: Thu, 23 Jun 2011 17:55:35 +0200 Lines: 18 Message-ID: References: <4E025E54.6020402@engene.se> <4E0261C1.8000807@2ndQuadrant.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p5dc4fa38.dip.t-dialin.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10 In-Reply-To: <4E0261C1.8000807@2ndQuadrant.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, T_RP_MATCHES_RCVD=-0.01, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201106/217 X-Sequence-Number: 44150 On 06/22/2011 11:42 PM, Greg Smith wrote: > On 06/22/2011 05:27 PM, Marcus Engene wrote: >> I have some tables with bitmask integers. Set bits are the interesting >> ones. Usually they are sparse. > > If it's sparse, create a partial index that just includes rows where the > bit is set: > http://www.postgresql.org/docs/current/static/indexes-partial.html That would mean that if different bits are queried there would need to be several of those indexes. Maybe it's an alternative to index all rows where misc_bits <> 0 and include that criterion in the query. Kind regards robert