From: Taylor Sarrafian <taylor@pex.com>
To: pgsql-general@postgresql.org
Subject: GIN Expression Indexes
Date: Tue, 28 Apr 2020 13:58:23 -0700
Message-ID: <AE32DDE9-865F-4DD3-9F8C-9B0CAAABA7AC@pex.com> (raw)
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!
ts=
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-general@postgresql.org
Cc: taylor@pex.com
Subject: Re: GIN Expression Indexes
In-Reply-To: <AE32DDE9-865F-4DD3-9F8C-9B0CAAABA7AC@pex.com>
References: <AE32DDE9-865F-4DD3-9F8C-9B0CAAABA7AC@pex.com>
* 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