Planner not choosing GIN index

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Planner not choosing GIN index
Date: 2019-03-13 01:44:13
Message-ID: CADkLM=d5DO1ud1tX0CUajmEwB3=jVUaUBqghv0116Jk=U7jKBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

A client had an issue with a where that had a where clause something like
this:

WHERE 123456 = ANY(integer_array_column)

I was surprised that this didn't use the pre-existing GIN index on
integer_array_column, whereas recoding as

WHERE ARRAY[123456] <@ integer_array_column

did cause the GIN index to be used. Is this a known/expected behavior? If
so, is there any logical reason why we couldn't have the planner pick up on
that?

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Flo Rance 2019-03-13 09:10:48 Re: Planner not choosing GIN index
Previous Message MichaelDBA 2019-03-12 20:11:49 Re: Shared_buffers