Use index with x = ANY(array_column) expression

From: Havasvölgyi Ottó <havasvolgyi(dot)otto(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Use index with x = ANY(array_column) expression
Date: 2018-06-08 19:01:47
Message-ID: CAOryeA2DHD_ZiuVtgzmBoBupjHHTPUUCW4_Ut9PbyjGM2ts=2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Is there a way to speed up ANY-based array element search with some kind of
index?
I mean this:

WHERE <parameter> = ANY(<array_column>)

Or is GIN index the only option with the @> operator?

WHERE <array_column> @> ARRAY[<parameter>]

Thank you,
Otto

Browse pgsql-general by date

  From Date Subject
Next Message Miguel Angel Sanchez Sandoval 2018-06-08 19:56:28 Performance problem postgresql 9.5
Previous Message Jeremy Finzel 2018-06-08 18:30:33 Re: ERROR: found multixact from before relminmxid