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 21ECD9DCD65 for ; Sat, 10 Dec 2005 16:17:15 -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 27622-09 for ; Sat, 10 Dec 2005 16:17:15 -0400 (AST) X-Greylist: delayed 03:02:30.235297 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 1F81A9DCB51 for ; Sat, 10 Dec 2005 16:17:13 -0400 (AST) Received: from pinus.cc.fer.hr (pinus.cc.fer.hr [161.53.73.18]) by svr2.postgresql.org (Postfix) with ESMTP id 3AE05F0B6E for ; Sat, 10 Dec 2005 17:14:40 +0000 (GMT) Received: from [161.53.72.113] (lara.cc.fer.hr [161.53.72.113]) by pinus.cc.fer.hr (8.12.2/8.12.2) with ESMTP id jBAHDtFx000250 for ; Sat, 10 Dec 2005 18:14:18 +0100 (MET) Message-ID: <439B0C9A.6010109@fer.hr> Date: Sat, 10 Dec 2005 18:12:58 +0100 From: Ivan Voras User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050921) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Bitmasks Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit 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/274 X-Sequence-Number: 16095 Can indexes be used for bit-filtering queries? For example: create table tt ( flags integer not null default 0, str varchar ); 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. 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)? Would strings and regular expressions work?