Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 42FF39FB200 for ; Tue, 6 Mar 2007 23:18:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 07840-07 for ; Tue, 6 Mar 2007 23:18:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from fmed.uba.ar (mail.fmed.uba.ar [157.92.152.1]) by postgresql.org (Postfix) with ESMTP id 17F4A9FB1DD for ; Tue, 6 Mar 2007 23:18:06 -0400 (AST) Received: from www.webmail.fmed.uba.ar (localhost [127.0.0.1]) by fmed.uba.ar (Postfix) with SMTP id 8331A4BEFF8 for ; Wed, 7 Mar 2007 00:28:57 -0300 (ART) Received: from 190.55.118.199 (SquirrelMail authenticated user gherzig) by www.webmail.fmed.uba.ar with HTTP; Wed, 7 Mar 2007 00:28:57 -0300 (ART) Message-ID: <22296.190.55.118.199.1173238137.squirrel@www.webmail.fmed.uba.ar> In-Reply-To: <20070306222802.GA16606@phlogiston.dyndns.org> References: <45EDDE5F.2030303@fmed.uba.ar> <20070306222802.GA16606@phlogiston.dyndns.org> Date: Wed, 7 Mar 2007 00:28:57 -0300 (ART) Subject: Re: best index for ~ ordering? From: gherzig@fmed.uba.ar To: pgsql-sql@postgresql.org User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.53 tagged_above=0 required=5 tests=AWL, BAYES_50, NO_REAL_NAME, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200703/65 X-Sequence-Number: 27703 Well, im wondering if is possible using LIKE '%blah%', even better would be upper/lower(string) like '%blah%', Im not at work right now, i will try it latter and makes you know about the results of using tsearch indexing. Thanks a lot, man! Gerardo > On Tue, Mar 06, 2007 at 06:34:23PM -0300, Gerardo Herzig wrote: >> Hi all, i have a large table with one varchar field, and im triyng to >> get information about what index should i use in order to using that >> index (if this is possible) for ~ searching, and/or using LIKE >> searching. > > What sort of match are you doing? If you're doing left-anchored > searches (LIKE 'blah%') then your standard btree is good. If you're > doing unanchored searches (LIKE '%blah%' or similar) you're best doing > tsearch. If it's right-anchored, you can do an index on the reverse > of the string. > > A > > -- > Andrew Sullivan | ajs@crankycanuck.ca > Unfortunately reformatting the Internet is a little more painful > than reformatting your hard drive when it gets out of whack. > --Scott Morris > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > -- Gerardo Herzig Direccion General de Organizacion y Sistemas Facultad de Medicina U.B.A.