Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ft0Fg-0004CW-Lz for pgsql-general@arkaria.postgresql.org; Fri, 24 Aug 2018 00:47:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ft0Fc-0002nC-6r for pgsql-general@arkaria.postgresql.org; Fri, 24 Aug 2018 00:46:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ft0FV-0002FX-Is for pgsql-general@lists.postgresql.org; Fri, 24 Aug 2018 00:46:49 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ft0FR-0007OB-I1 for pgsql-general@postgresql.org; Fri, 24 Aug 2018 00:46:48 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 1E70C412C7; Fri, 24 Aug 2018 02:46:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id ppaYbYlYtrBe; Fri, 24 Aug 2018 02:46:41 +0200 (CEST) Message-ID: Subject: Re: Is my text_pattern_ops index working for a LIKE prefix search with column reference? From: Laurenz Albe To: Seamus Abshere , pgsql-general@postgresql.org Date: Fri, 24 Aug 2018 02:46:38 +0200 In-Reply-To: <1535036221.3796184.1483854296.64E1B683@webmail.messagingengine.com> References: <1535036221.3796184.1483854296.64E1B683@webmail.messagingengine.com> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Seamus Abshere wrote: > I created an index with text_pattern_ops because I want fast prefix search [1] [2]. > > ...but I don't think it's working when I use a column reference || '%'... An index can only be used for expressions like and you have a column refrence on the right side. Perhaps you can rephrase your query in such a fashion. Yours, Laurenz Albe