Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahvDX-0002Mk-IQ for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Mar 2016 08:29:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ahvDW-0000gs-GL for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Mar 2016 08:29:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ahvCt-0008Qi-Cx for pgsql-bugs@postgresql.org; Mon, 21 Mar 2016 08:28:59 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ahvCp-0003H1-Qz for pgsql-bugs@postgresql.org; Mon, 21 Mar 2016 08:28:58 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 8D63121C7093; Mon, 21 Mar 2016 11:28:54 +0300 (MSK) Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gL9msuTiWPNz; Mon, 21 Mar 2016 11:28:53 +0300 (MSK) Received: from [192.168.27.188] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 0968C21C6E81; Mon, 21 Mar 2016 11:28:53 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1458548933; bh=9BRGjCxp68RtgoSWcWjaM1ErLurpklFHtzeEFo11epY=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=w2hul3+MsRKAVQCDMsl5tI+oqjuKoVYwu2BvYkek5egVq6QMhVVCmPJwomCkMd24Q qAv9AMceDyOF5Jw4fDydSjPUZvtCxPAWD9WungK48q/2xS1Zm86yW4WEqxJPZCOTM+ O+rZMKzdceeig8eFerCD4oqwlHvJP8Qt/jvPYdh4= Subject: Re: BUG #14032: trigram index is not used for '=' operator To: Jeff Janes References: <20160318100427.2903.57536@wrigleys.postgresql.org> Cc: ruslan.zakirov@gmail.com, Pg Bugs From: Artur Zakirov Message-ID: <56EFB0C4.2000308@postgrespro.ru> Date: Mon, 21 Mar 2016 11:28:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 20.03.2016 04:06, Jeff Janes wrote: > > I think it is actually quite trivial to support '='. In fact I think > that all you have to do is tap into the same code that LIKE already > uses, and let the recheck remove things which match on the LIKE > interpretation of the query string but not the equality > interpretation. > > Attached is a crude patch I put together which seems to do the job, > but I haven't thoroughly tested it. > > The main problem is likely to be that there is already a really good > index type for speeding up equality queries (btree), and adding > another (generally much worse) alternative is likely to confuse the > planner more than anything. Is it really worth taking the performance > hit on executing the equality query in order to avoid just keeping a > second btree index? Maybe not :) > > If I could somehow turn this into an extension module that installed > with pg_trgm as a dependency, rather than reaching into pg_trgm's > internals, then it might be worthwhile putting something like this on > PGXN. But I don't know how to do that. And it doesn't seem > worthwhile to change pg_trgm itself in this way. > > But in any case, it isn't a bug that pg_trgm doesn't do everything it > theoretically could do. Yes. And so this changes can be applied only for PostgreSQL 9.7. > > Cheers, > > Jeff > -- Artur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs