Re: GIN Expression Indexes - Mailing list pgsql-general

From Adrian Klaver
Subject Re: GIN Expression Indexes
Date
Msg-id d93dc344-6997-51db-219f-c2580d84f22a@aklaver.com
Whole thread Raw
In response to GIN Expression Indexes  (Taylor Sarrafian <taylor@pex.com>)
List pgsql-general
On 4/28/20 1:58 PM, Taylor Sarrafian wrote:
> Hi friends!
> 
> We tried to index an array function like this:
> 
>    CREATE INDEX my_arr_index ON my_table USING GIN ( my_arr_func( my_col ) )
> 
> But the planner can’t seem to figure out how to use the index with any 
> query! It doesn’t work with any array operators.
> 
>    SELECT * FROM my_table WHERE ARRAY[ 123 ]::INT[] && my_arr_func( my_col )
> 
> Even weirder, an empty array correctly uses the index:
> 
>    SELECT * FROM my_table WHERE ARRAY[]::INT[] && my_arr_func( my_col )
> 
> Is there any way to coerce Postgres into using this index? Thanks!

Well without:

1) Table schema.

2) EXPLAIN ANALYZE for the query(s)

there is really not information to formulate an answer.

> 
> ts


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Taylor Sarrafian
Date:
Subject: GIN Expression Indexes
Next
From: Durgamahesh Manne
Date:
Subject: Regarding db performance improvement