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 2D85A9DC819 for ; Sat, 25 Feb 2006 10:17:42 -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 84601-06 for ; Sat, 25 Feb 2006 10:17: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 E57EC9DCBB7 for ; Sat, 25 Feb 2006 10:17:39 -0400 (AST) Received: from deneb.vpn.enyo.de ([212.9.189.177] helo=deneb.enyo.de) by mail.enyo.de with esmtp id 1FD0Ew-0008AS-RX for pgsql-sql@postgresql.org; Sat, 25 Feb 2006 15:17:42 +0100 Received: from fw by deneb.enyo.de with local (Exim 4.60) (envelope-from ) id 1FD0Ev-000492-V3 for pgsql-sql@postgresql.org; Sat, 25 Feb 2006 15:17:41 +0100 From: Florian Weimer To: pgsql-sql@postgresql.org Subject: Index to support LIKE '%suffix' queries Date: Sat, 25 Feb 2006 15:17:41 +0100 Message-ID: <87mzgfh69m.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/313 X-Sequence-Number: 24323 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)? I could define a function which reverts strings (or revert them in the application) and use a normal B-tree index, but I wonder if there is a better way.