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 702CA5E46D4 for ; Tue, 24 Aug 2004 18:00:55 -0300 (ADT) 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 82574-02 for ; Tue, 24 Aug 2004 21:00:50 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 70E9D5E46C3 for ; Tue, 24 Aug 2004 18:00:49 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 1BziPS-000PdG-0Y; Tue, 24 Aug 2004 21:00:51 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 190AC16B14; Tue, 24 Aug 2004 22:00:50 +0100 (BST) Message-ID: <412BAC80.4050507@archonet.com> Date: Tue, 24 Aug 2004 22:00:48 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.7 (X11/20040615) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Ceregatti Cc: pgsql-performance@postgresql.org Subject: Re: What is the best way to do attribute/values? References: <4124EB58.9040102@sh.nu> In-Reply-To: <4124EB58.9040102@sh.nu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: 200408/330 X-Sequence-Number: 7966 Daniel Ceregatti wrote: > Hi list, > > I have a database with 1M "people" in it. Each person has about 20 > attributes, such as height, weight, eye color, etc. I need to be able to > search for people based on these attributes. A search can be conducted > on one attribute, all attributes, or any number in between. How would > _you_ do this? > > I have already attempted to answer this. My attempts are detailed here: > > http://sh.nu/email.txt Hmm... interesting. Shot in the dark - try a tsearch2 full-text index. Your problem could be translated into searching strings of the form "hair=black eyes=blue age=117" Not pretty, but might give you the speed you want. -- Richard Huxton Archonet Ltd