From: James Inform <james.inform@pharmapp.de>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15948: TRGM gin index is not be taken into account when using like all (array)
Date: Mon, 12 Aug 2019 11:57:00 +0200 (CEST)
Message-ID: <741027258.89460.1565603820750@email.ionos.de> (raw)
In-Reply-To: <22763.1565566888@sss.pgh.pa.us>
References: <15948-8767af672d99063a@postgresql.org>
<22763.1565566888@sss.pgh.pa.us>
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
</head><body><p><br></p><blockquote type="cite">On August 12, 2019 at 1:41 AM Tom Lane <<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>> wrote:<br><br><br>PG Bug reporting form <<a href="mailto:noreply@postgresql.org">noreply@postgresql.org</a>> writes:<blockquote type="cite">-- Now try to query all record which contain "36dedd" AND "4e45f"<br>-- Using LIKE ALL, a seq scan is used which is very expensive<br>explain analyze<br>select * from mytable where mytext like all (array['%36dedd%','%4e45f%']);</blockquote><br>This is not a bug. At most it's an unimplemented feature ...<br>one I can't get very excited about, considering how little<br>use there is for such queries.<br><br> regards, tom lane</blockquote><p>Thanks for the clarification. I just stumbled about this because</p><p><code><strong>select * from mytable where mytext like any (array['%36dedd%','%4e45f%'])</strong></code></p><p>uses the gin index the same way as</p><p><code><strong>select * from mytable where mytext like '%36dedd%' or mytext like '%4e45f%'</strong></code></p><p>does.</p><p><br></p><p>Its not a show stopper in any way, but for me a working</p><p><strong><code>select * from mytable where mytext like all (array['%36dedd%','%4e45f%'])</code></strong></p><p>would be more elegant and more readable, because I am dealing with big amounts of free text columns.</p><p>Although I use full text search on those columns, I have a need to identify records where different search strings are contained (front and end masked, like '%part%'). This is because the free texts have many compound words, where I want to find words containing specific search strings.</p><p><br></p><p><em>Maybe this could be a good starting point for me for becoming involved. Could someone point me to the relevant source code area where this <strong>"LIKE ALL"</strong> handling should be implemented?!</em></p></body></html>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: james.inform@pharmapp.de
Subject: Re: BUG #15948: TRGM gin index is not be taken into account when using like all (array)
In-Reply-To: <741027258.89460.1565603820750@email.ionos.de>
References: <15948-8767af672d99063a@postgresql.org> <22763.1565566888@sss.pgh.pa.us> <741027258.89460.1565603820750@email.ionos.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox