From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-general@postgresql.org
Subject: Re: Overloaded && operator from intarray module prevents index usage.
Date: Thu, 28 Feb 2019 09:29:03 +0000
Message-ID: <87ef7se0q3.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <q583lv$5t8m$1@blaine.gmane.org>
References: <q583lv$5t8m$1@blaine.gmane.org>
>>>>> "Thomas" == Thomas Kellerer <spam_eater@gmx.net> writes:
[intarray woes]
Thomas> Is this expected behaviour? Is this caused by the Postgres core
Thomas> (e.g. the optimizer to taking the opclass into account) or is
Thomas> it a "problem" in the way the intarray module defines its
Thomas> operators?
It's basically a conflict between intarray (which is historically older)
and the built-in array indexing support.
The reason it happens is that the operator resolution logic matches an
(integer[] && integer[]) operator in preference to (anyarray && anyarray)
regardless of their relative position on the search_path. This
resolution happens before anything is known about any indexes that might
be applicable. Then later, at planning time, an index is chosen based on
the operator, not the reverse.
My own recommendation for most cases is to never install intarray on the
search path, and invoke its functions via explicit qualification or wrap
them in your own functions.
--
Andrew (irc:RhodiumToad)
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: andrew@tao11.riddles.org.uk, spam_eater@gmx.net
Subject: Re: Overloaded && operator from intarray module prevents index usage.
In-Reply-To: <87ef7se0q3.fsf@news-spur.riddles.org.uk>
References: <q583lv$5t8m$1@blaine.gmane.org> <87ef7se0q3.fsf@news-spur.riddles.org.uk>
* 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