Re: BUG #15948: TRGM gin index is not be taken into account when using like all (array)

From: James Inform <james(dot)inform(at)pharmapp(dot)de>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15948: TRGM gin index is not be taken into account when using like all (array)
Date: 2019-08-12 09:57:00
Message-ID: 741027258.89460.1565603820750@email.ionos.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<!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 &#60;<a href="mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us">tgl(at)sss(dot)pgh(dot)pa(dot)us</a>&#62; wrote:<br><br><br>PG Bug reporting form &#60;<a href="mailto:noreply(at)postgresql(dot)org">noreply(at)postgresql(dot)org</a>&#62; writes:<blockquote type="cite">-- Now try to query all record which contain &#34;36dedd&#34; AND &#34;4e45f&#34;<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[&#39;%36dedd%&#39;,&#39;%4e45f%&#39;]);</blockquote><br>This is not a bug. At most it&#39;s an unimplemented feature ...<br>one I can&#39;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[&#39;%36dedd%&#39;,&#39;%4e45f%&#39;])</strong></code></p><p>uses the gin index the same way as</p><p><code><strong>select * from mytable where mytext like &#39;%36dedd%&#39; or mytext like &#39;%4e45f%&#39;</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[&#39;%36dedd%&#39;,&#39;%4e45f%&#39;])</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 &#39;%part%&#39;). 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>&#34;LIKE ALL&#34;</strong> handling should be implemented?!</em></p></body></html>

Attachment Content-Type Size
unknown_filename text/html 2.0 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-08-12 10:31:12 BUG #15949: pg_basebackup failed(PG-12-Beta3)
Previous Message Arthur Zakirov 2019-08-12 09:12:13 Re: BUG #15892: URGENT: Using an ICU collation in a primary key column breaks ILIKE query