<!-- 
RSS generated by JIRA (1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d) at Thu Feb 08 23:18:58 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>FOLIO Jira</title>
    <link>https://folio-org.atlassian.net</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>1001.0.0-SNAPSHOT</version>
        <build-number>100246</build-number>
        <build-date>07-02-2024</build-date>
    </build-info>

<item>
            <title>[RMB-441] Consider to use = over LIKE when search term has no wildcard</title>
                <link>https://folio-org.atlassian.net/browse/RMB-441</link>
                <project id="10140" key="RMB">RAML Module Builder</project>
                    <description>&lt;p&gt;While working on 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;FOLIO-2197&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/FOLIO-2197&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Research &amp;quot;get inventory items by status&amp;quot; slow in perf test &quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium&quot; /&gt;
            FOLIO-2197
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
, it was observed that there is a difference between = and LIKE search. See below (copied from 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;FOLIO-2197&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/FOLIO-2197&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Research &amp;quot;get inventory items by status&amp;quot; slow in perf test &quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium&quot; /&gt;
            FOLIO-2197
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
 comments section) for details.&lt;/p&gt;

&lt;p&gt;1) if there is only BTREE index: All searches use index except LIKE search for &quot;Available&quot;.&lt;br/&gt;
Note: there are two types of item: &quot;Available&quot; vs &quot;Checked out&quot;. The number of &quot;Available&quot; item (2837576) is more than 97% of total item records (2908646). In general, the btree index is much faster than gin. The results show the difference and it seems we should &lt;b&gt;use = over LIKE when there is no wildcard&lt;/b&gt;.&lt;br/&gt;
2) if there is only GIN index: LIKE search for &quot;Checked out&quot; can use the index; others do not.&lt;/p&gt;

&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;b-tree&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;LIKE&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Available&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;7326 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;b-tree&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;LIKE&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Checked out&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;470 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;b-tree&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;=&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Available&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;1465 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;b-tree&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;=&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Checked out&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;292 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;gin&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;LIKE&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Available&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;7150 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;gin&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;LIKE&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Checked out&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;1305 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;gin&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;=&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Available&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;7151 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;gin&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;=&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Checked out&lt;/td&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;6624 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
1) with just b-tree index: &lt;span class=&quot;code-quote&quot;&gt;&quot;item_status_name_idx&quot;&lt;/span&gt; btree (lower(f_unaccent((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text)))
folio=# vacuum analyze supertenant_mod_inventory_storage.item;
VACUUM
folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) LIKE lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Available&apos;&lt;/span&gt;));
                                                       QUERY PLAN                                                        
-------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=1056834.36..1056834.38 rows=1 width=8) (actual time=7326.753..7326.753 rows=1 loops=1)
   -&amp;gt;  Seq Scan on item  (cost=0.00..1049759.31 rows=2830022 width=0) (actual time=0.054..7060.456 rows=2837576 loops=1)
         Filter: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) ~~ &lt;span class=&quot;code-quote&quot;&gt;&apos;available&apos;&lt;/span&gt;::text)
         Rows Removed by Filter: 71070
 Planning time: 0.215 ms
 Execution time: 7326.774 ms
(6 rows)

folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) LIKE lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Checked out&apos;&lt;/span&gt;));
                                                                  QUERY PLAN                                                                   
-----------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=58888.39..58888.40 rows=1 width=8) (actual time=469.995..469.996 rows=1 loops=1)
   -&amp;gt;  Index Scan using item_status_name_idx on item  (cost=0.43..58691.81 rows=78631 width=0) (actual time=0.445..461.876 rows=71070 loops=1)
         Index Cond: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) = &lt;span class=&quot;code-quote&quot;&gt;&apos;checked out&apos;&lt;/span&gt;::text)
         Filter: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) ~~ &lt;span class=&quot;code-quote&quot;&gt;&apos;checked out&apos;&lt;/span&gt;::text)
 Planning time: 0.158 ms
 Execution time: 470.019 ms
(6 rows)

folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) = lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Available&apos;&lt;/span&gt;));
                                                                     QUERY PLAN                                                                      
-----------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=443045.82..443045.83 rows=1 width=8) (actual time=1465.292..1465.292 rows=1 loops=1)
   -&amp;gt;  Index Scan using item_status_name_idx on item  (cost=0.43..435970.76 rows=2830022 width=0) (actual time=0.063..1263.410 rows=2837576 loops=1)
         Index Cond: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) = &lt;span class=&quot;code-quote&quot;&gt;&apos;available&apos;&lt;/span&gt;::text)
 Planning time: 0.154 ms
 Execution time: 1465.317 ms
(5 rows)

folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) = lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Checked out&apos;&lt;/span&gt;));
                                                                  QUERY PLAN                                                                   
-----------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=38444.33..38444.34 rows=1 width=8) (actual time=291.678..291.679 rows=1 loops=1)
   -&amp;gt;  Index Scan using item_status_name_idx on item  (cost=0.43..38247.75 rows=78631 width=0) (actual time=0.094..285.701 rows=71070 loops=1)
         Index Cond: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) = &lt;span class=&quot;code-quote&quot;&gt;&apos;checked out&apos;&lt;/span&gt;::text)
 Planning time: 0.154 ms
 Execution time: 291.704 ms
(5 rows)

2) With just gin index: &lt;span class=&quot;code-quote&quot;&gt;&quot;item_status_name_idx_gin&quot;&lt;/span&gt; gin (lower(f_unaccent((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text)) gin_trgm_ops)
folio=# vacuum analyze supertenant_mod_inventory_storage.item;
VACUUM
folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) LIKE lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Available&apos;&lt;/span&gt;));
                                                       QUERY PLAN                                                        
-------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=1056851.82..1056851.83 rows=1 width=8) (actual time=7149.606..7149.606 rows=1 loops=1)
   -&amp;gt;  Seq Scan on item  (cost=0.00..1049759.31 rows=2837003 width=0) (actual time=0.053..6895.869 rows=2837576 loops=1)
         Filter: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) ~~ &lt;span class=&quot;code-quote&quot;&gt;&apos;available&apos;&lt;/span&gt;::text)
         Rows Removed by Filter: 71070
 Planning time: 0.202 ms
 Execution time: 7149.625 ms
(6 rows)

folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) LIKE lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Checked out&apos;&lt;/span&gt;));
                                                                     QUERY PLAN                                                                     
----------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=189376.56..189376.57 rows=1 width=8) (actual time=1305.208..1305.208 rows=1 loops=1)
   -&amp;gt;  Bitmap Heap Scan on item  (cost=9923.29..189197.43 rows=71650 width=0) (actual time=43.358..1296.635 rows=71070 loops=1)
         Recheck Cond: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) ~~ &lt;span class=&quot;code-quote&quot;&gt;&apos;checked out&apos;&lt;/span&gt;::text)
         Rows Removed by Index Recheck: 337220
         Heap Blocks: exact=37348 lossy=33722
         -&amp;gt;  Bitmap Index Scan on item_status_name_idx_gin  (cost=0.00..9905.37 rows=71650 width=0) (actual time=37.155..37.155 rows=71070 loops=1)
               Index Cond: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) ~~ &lt;span class=&quot;code-quote&quot;&gt;&apos;checked out&apos;&lt;/span&gt;::text)
 Planning time: 0.161 ms
 Execution time: 1305.239 ms
(9 rows)

folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) = lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Available&apos;&lt;/span&gt;));
                                                       QUERY PLAN                                                        
-------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=1056851.82..1056851.83 rows=1 width=8) (actual time=7151.198..7151.198 rows=1 loops=1)
   -&amp;gt;  Seq Scan on item  (cost=0.00..1049759.31 rows=2837003 width=0) (actual time=0.063..6896.387 rows=2837576 loops=1)
         Filter: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) = &lt;span class=&quot;code-quote&quot;&gt;&apos;available&apos;&lt;/span&gt;::text)
         Rows Removed by Filter: 71070
 Planning time: 0.146 ms
 Execution time: 7151.217 ms
(6 rows)

folio=# explain analyze SELECT COUNT(1) FROM supertenant_mod_inventory_storage.item  WHERE lower(f_unaccent(item.jsonb-&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;)) = lower(f_unaccent(&lt;span class=&quot;code-quote&quot;&gt;&apos;Checked out&apos;&lt;/span&gt;));
                                                     QUERY PLAN                                                      
---------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=1049938.44..1049938.45 rows=1 width=8) (actual time=6624.144..6624.144 rows=1 loops=1)
   -&amp;gt;  Seq Scan on item  (cost=0.00..1049759.31 rows=71650 width=0) (actual time=0.431..6615.394 rows=71070 loops=1)
         Filter: (lower(f_unaccent(((jsonb -&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;status&apos;&lt;/span&gt;::text) -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;name&apos;&lt;/span&gt;::text))) = &lt;span class=&quot;code-quote&quot;&gt;&apos;checked out&apos;&lt;/span&gt;::text)
         Rows Removed by Filter: 2837576
 Planning time: 0.142 ms
 Execution time: 6624.164 ms
(6 rows)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="57169">RMB-441</key>
            <summary>Consider to use = over LIKE when search term has no wildcard</summary>
                <type id="10003" iconUrl="https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium">Task</type>
                                            <priority id="10002" iconUrl="https://dev.folio.org/assets/jira-priority/jira-p3.svg">P3</priority>
                        <status id="6" iconUrl="https://folio-org.atlassian.net/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Won&apos;t Do</resolution>
                                                        <assignee accountid="-1">Unassigned</assignee>
                                                                <reporter accountid="557058:4f6bed01-40a6-48d5-8471-7ef21f5ea97c">Hongwei Ji</reporter>
                                    <labels>
                            <label>platform-backlog</label>
                    </labels>
                <created>Wed, 31 Jul 2019 14:48:54 +0000</created>
                <updated>Mon, 31 May 2021 12:31:34 +0000</updated>
                            <resolved>Mon, 31 May 2021 12:31:34 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                <comments>
                                                            <comment id="135802" author="5ee89462f7aa140abd82d11d" created="Sat, 3 Aug 2019 09:55:16 +0000"  >&lt;p&gt;&lt;a href=&quot;https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-LIKE&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-LIKE&lt;/a&gt; says:&lt;br/&gt;
&quot;If pattern does not contain percent signs or underscores, then the pattern only represents the string itself; in that case LIKE acts like the equals operator.&quot;&lt;/p&gt;

&lt;p&gt;Reproducable example:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
create table t(jsonb jsonb);
create unique index on t ((jsonb-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;barcode&apos;&lt;/span&gt;));
explain analyse select * from t where jsonb-&amp;gt;&amp;gt;&lt;span class=&quot;code-quote&quot;&gt;&apos;barcode&apos;&lt;/span&gt; LIKE &lt;span class=&quot;code-quote&quot;&gt;&apos;abc&apos;&lt;/span&gt;;
                                                  QUERY PLAN                                                   
---------------------------------------------------------------------------------------------------------------
 Index Scan using t_expr_idx on t  (cost=0.15..8.18 rows=1 width=32) (actual time=0.028..0.028 rows=0 loops=1)
   Index Cond: ((jsonb -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;barcode&apos;&lt;/span&gt;::text) = &lt;span class=&quot;code-quote&quot;&gt;&apos;abc&apos;&lt;/span&gt;::text)
   Filter: ((jsonb -&amp;gt;&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;barcode&apos;&lt;/span&gt;::text) ~~ &lt;span class=&quot;code-quote&quot;&gt;&apos;abc&apos;&lt;/span&gt;::text)
 Planning Time: 0.571 ms
 Execution Time: 0.075 ms
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note that the query uses the index and uses &lt;tt&gt;=&lt;/tt&gt; to lookup &apos;abc&apos; in the index.&lt;/p&gt;

&lt;p&gt;PostgreSQL has already implemented the optimization to use &lt;tt&gt;=&lt;/tt&gt; when the LIKE term has no wildcard. We should not duplicate such code.&lt;/p&gt;</comment>
                                                            <comment id="135803" author="5ee89462f7aa140abd82d11d" created="Sat, 3 Aug 2019 10:20:24 +0000"  >&lt;p&gt;Changing from LIKE to = doesn&apos;t make the query fast enough, 1465 ms is still to slow for other reasons. These other reasons are discussed in 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;FOLIO-2197&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/FOLIO-2197&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Research &amp;quot;get inventory items by status&amp;quot; slow in perf test &quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium&quot; /&gt;
            FOLIO-2197
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
 . If these other reasons have been resolved we most probably no longer need any LIKE/= change.&lt;br/&gt;
Therefore I suggest to close this issue as won&apos;t do and reopen it if needed.&lt;/p&gt;</comment>
                                                            <comment id="135804" author="557058:4f6bed01-40a6-48d5-8471-7ef21f5ea97c" created="Thu, 29 Aug 2019 15:28:45 +0000"  >&lt;p&gt;Could it be that in simple cases, the optimizer can do it right but not in more complex cases like what we observed above? I am not sure it is a wasted effort to try to use the most suitable syntax where you can. I guess I do not have as much faith on the optimizer as Julian does.&lt;/p&gt;</comment>
                                                            <comment id="135805" author="5ee89462f7aa140abd82d11d" created="Thu, 29 Aug 2019 15:31:27 +0000"  >&lt;p&gt;This should be closed as &quot;Won&apos;t do&quot;.&lt;br/&gt;
See 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;MODINVSTOR-336&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-336&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;GET inventory_items?query=(status.name==&amp;quot;Available&amp;quot;) slow&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium&quot; /&gt;
            MODINVSTOR-336
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
 why the performance tests should use the /item-storage/items endpoint and not the /inventory/items endpoint.&lt;br/&gt;
Please show a real use case that this issue solves.&lt;br/&gt;
I cannot reproduce the numbers shown in the description. Please provide complete information how to reproduce, for example a complete .sql file that I can feed into psql.&lt;/p&gt;</comment>
                                                            <comment id="135806" author="557058:4f6bed01-40a6-48d5-8471-7ef21f5ea97c" created="Thu, 29 Aug 2019 15:38:43 +0000"  >&lt;p&gt;The numbers were from platform perf test env. The db was populated from &lt;a href=&quot;https://s3.amazonaws.com/folio-public-sample-data/perf.tar.gz&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://s3.amazonaws.com/folio-public-sample-data/perf.tar.gz&lt;/a&gt;. It contains a bash file to copy the data to db.&lt;/p&gt;</comment>
                                                            <comment id="135807" author="5f8314dfbdef80006f6f572d" created="Tue, 3 Sep 2019 08:56:18 +0000"  >&lt;p&gt;If anything this shows that in many cases it does not make sense to provide make a separate gin-index .. (It modules can simply choose not to define it). Fewer indexes &amp;#8211; faster updates/insertion.&lt;/p&gt;

&lt;p&gt;By the way: if a module does not define a gin-index will our CQL2PgJSON fail a search using == ? Or just be terribly slow?&lt;/p&gt;</comment>
                                                            <comment id="135808" author="557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d" created="Tue, 3 Sep 2019 09:20:02 +0000"  >&lt;p&gt;Guys, I think it might make sense to try removing the GIN index from the status field in mod-inventory-storage and verifying the performance. But I don&apos;t think we will see general gains. it might make more sense to look at limiting the size of the results in the subquery (see 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;RMB-467&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/RMB-467&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;SPIKE: how to sort and select on the data from foreign tables?&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium&quot; /&gt;
            RMB-467
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
)&lt;/p&gt;</comment>
                                                            <comment id="135809" author="557058:f8c71e3c-04a0-49c1-bae9-f8f88e253821" created="Mon, 31 May 2021 12:31:22 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A4f6bed01-40a6-48d5-8471-7ef21f5ea97c&quot; class=&quot;user-hover&quot; rel=&quot;557058:4f6bed01-40a6-48d5-8471-7ef21f5ea97c&quot; data-account-id=&quot;557058:4f6bed01-40a6-48d5-8471-7ef21f5ea97c&quot; accountid=&quot;557058:4f6bed01-40a6-48d5-8471-7ef21f5ea97c&quot; rel=&quot;noreferrer&quot;&gt;Hongwei Ji&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ab8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; class=&quot;user-hover&quot; rel=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; data-account-id=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; accountid=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; rel=&quot;noreferrer&quot;&gt;Jakub Skoczen&lt;/a&gt;&#160;we are closing this as we think this is not needed. Please reopen if you think in different way. Thanks!&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                                                <inwardlinks description="is blocked by">
                                        <issuelink>
            <issuekey id="55923">MODINVSTOR-256</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="37503">CQLPG-80</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="81261">FOLIO-2197</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummarycf">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10057" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Development Team</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10144"><![CDATA[Core: Platform]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10019" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|hzx3o9:zzzzzzr</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10020" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="773">CP: Roadmap backlog</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10024" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>[CHART] Date of First Response</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 3 Aug 2019 09:55:16 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10025" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>[CHART] Time in Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>