X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66508329F35 for ; Tue, 5 Oct 2004 17:33:41 +0100 (BST) 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 70476-05 for ; Tue, 5 Oct 2004 16:33:31 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id A1F52329F26 for ; Tue, 5 Oct 2004 17:33:30 +0100 (BST) Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6461122 for pgsql-performance@postgresql.org; Tue, 05 Oct 2004 09:34:52 -0700 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Comparing user attributes with bitwise operators Date: Tue, 5 Oct 2004 09:32:38 -0700 User-Agent: KMail/1.6.2 References: <200409160141.37604.patrick@phpforhire.com> <87sm9eluc3.fsf@stark.xeocode.com> <200410050039.24230.patrick@phpforhire.com> In-Reply-To: <200410050039.24230.patrick@phpforhire.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200410050932.38595.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/43 X-Sequence-Number: 8519 Patrick, First off, thanks for posting this solution! I love to see a new demo of The Power of Postgres(tm) and have been wondering about this particular problem since it came up on IRC. > The array method works quite nicely, especially for the > columns like "languages" and "seeking" that are multiple choice. However, > even though this method is fast, I still might opt for caching the results > because the "real world" search query involves a lot more and will be > executed non-stop. But to have it run this fast the first time certainly > helps. Now, for the bad news: you need to test having a large load of users updating their data. The drawback to GiST indexes is that they are low-concurrency, because the updating process needs to lock the whole index (this has been on our TODO list for about a decade, but it's a hard problem). -- Josh Berkus Aglio Database Solutions San Francisco