X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 848059DCAC7 for ; Sat, 25 Feb 2006 13:52:47 -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 31075-02 for ; Sat, 25 Feb 2006 13:52:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.enyo.de (mail.enyo.de [212.9.189.167]) by postgresql.org (Postfix) with ESMTP id 6330E9DCA4A for ; Sat, 25 Feb 2006 13:52:45 -0400 (AST) Received: from deneb.vpn.enyo.de ([212.9.189.177] helo=deneb.enyo.de) by mail.enyo.de with esmtp id 1FD3b3-0003e4-63; Sat, 25 Feb 2006 18:52:45 +0100 Received: from fw by deneb.enyo.de with local (Exim 4.60) (envelope-from ) id 1FD3b1-0004nc-97; Sat, 25 Feb 2006 18:52:43 +0100 From: Florian Weimer To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: Index to support LIKE '%suffix' queries References: <87mzgfh69m.fsf@mid.deneb.enyo.de> <11673.1140888147@sss.pgh.pa.us> Date: Sat, 25 Feb 2006 18:52:43 +0100 In-Reply-To: <11673.1140888147@sss.pgh.pa.us> (Tom Lane's message of "Sat, 25 Feb 2006 12:22:27 -0500") Message-ID: <877j7jfhqs.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200602/317 X-Sequence-Number: 24327 * Tom Lane: > Florian Weimer writes: >> Is it possible to create an index to support queries of the form >> "column LIKE '%suffix'" (similar to an ordinary index for LIKE >> 'prefix%', which I also need)? > > Sounds like what you *really* need is full-text search, not half > measures ... have you looked at tsearch2? Uh-oh, the table in question has got 50+ million rows (and is still growing). Each "document" contains about three words. Do you think tsearch2 could deal with that?