Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6F1751337B64 for ; Tue, 30 Nov 2010 14:36:36 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 37154-05 for ; Tue, 30 Nov 2010 18:36:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mh5.mail.rice.edu (mh5.mail.rice.edu [128.42.199.32]) by mail.postgresql.org (Postfix) with ESMTP id C2AE7133655C for ; Tue, 30 Nov 2010 14:36:28 -0400 (AST) Received: from mh5.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh5.mail.rice.edu (Postfix) with ESMTP id 0675328F788; Tue, 30 Nov 2010 12:36:28 -0600 (CST) X-Virus-Scanned: by amavis-2.6.4 at mh5.mail.rice.edu, auth channel Received: from mh5.mail.rice.edu ([127.0.0.1]) by mh5.mail.rice.edu (mh5.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id EHjL+u4D2Oct; Tue, 30 Nov 2010 12:36:27 -0600 (CST) X-SMTP-Auth: no X-SMTP-Auth: no Received: from aart.is.rice.edu (aart.is.rice.edu [168.7.56.48]) by mh5.mail.rice.edu (Postfix) with ESMTP id C5F0828F755; Tue, 30 Nov 2010 12:36:27 -0600 (CST) Received: by aart.is.rice.edu (Postfix, from userid 18612) id 842922D5A6; Tue, 30 Nov 2010 12:36:27 -0600 (CST) Date: Tue, 30 Nov 2010 12:36:27 -0600 From: Kenneth Marshall To: Rob Sargent Cc: pgsql-sql@postgresql.org Subject: Re: indexing longish string Message-ID: <20101130183627.GL19162@aart.is.rice.edu> References: <4CF53797.4040806@gmail.com> <4CF53B0B.8060906@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CF53B0B.8060906@gmail.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/94 X-Sequence-Number: 34832 You can use a hash index for this. It's drawback is that it is not yet WAL enabled and if your DB crashes you will need to rebuild the index to fix the corruption. It works well(only) with equality searches. If it is a scenario where you must have WAL, use a function index based on the hash of the string. Cheers, Ken On Tue, Nov 30, 2010 at 10:57:31AM -0700, Rob Sargent wrote: > If the performance against an index doesn't cut it, we would be forced > to choose just such an implementation, but if pg can do it straight up > that would be less work for us. A good thing, to be sure. > > On 11/30/2010 10:50 AM, jose wrote: > > Why don't you use some type of hash like md5 for indexing ? > > > > 2010/11/30 Rob Sargent : > >> Were we to create a table which included a text field for a small block > >> of xml (100-1000 chars worth), would an index on that field be useful > >> against exact match queries? > >> > >> We're wondering if a criterion such as "where 'a string expected to be > >> of size range 100 to 500' = tabelWithStrings.stringSearched" would make > >> good use of an index on "stringSearched" column. > >> > >> The key is that there will only be exact match queries. > >> > >> Thanks for your thoughts. > >> > >> > >> > >> -- > >> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > >> To make changes to your subscription: > >> http://www.postgresql.org/mailpref/pgsql-sql > >> > > > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql >