X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1D5EC9DCAE5 for ; Sun, 11 Dec 2005 02:12:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61947-09 for ; Sun, 11 Dec 2005 02:12:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id 8553A9DCAB8 for ; Sun, 11 Dec 2005 02:12:15 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1ElKRM-0007pc-00; Sun, 11 Dec 2005 01:12:08 -0500 To: Ivan Voras Cc: pgsql-performance@postgresql.org Subject: Re: Bitmasks References: <439B0C9A.6010109@fer.hr> In-Reply-To: <439B0C9A.6010109@fer.hr> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 11 Dec 2005 01:12:08 -0500 Message-ID: <87oe3of9hj.fsf@stark.xeocode.com> Lines: 21 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/275 X-Sequence-Number: 16096 Ivan Voras writes: > select * from tt where (flags & 16) != 0; > > I suspected radix trees could be used for this but it seems it doesn't work > that way. You would need a gist index method to make this work. I actually worked on one for a while and had it working. But it wasn't really finished. If there's interest I could finish it up and put it up somewhere like pgfoundry. > If not, is there a way of quickly filtering by such "elements of a set" that > doesn't involve creating 32 boolean fields (which would also need to be pretty > uselessly indexed separately)? You could create 32 partial indexes on some other column which wouldn't really take much more space than a single index on that other column. But that won't let you combine them effectively as a gist index would. -- greg