pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Overloaded && operator from intarray module prevents index usage.
Date: Thu, 28 Feb 2019 21:38:14 +0100
Message-ID: <0adbbf65-d596-bb45-b58a-95e08517c699@gmx.net> (raw)
In-Reply-To: <CAHOFxGpW7JkX8HGW4MFFrSagCdW08yM-DK1jZvRJnj7dp84m=A@mail.gmail.com>
References: <q583lv$5t8m$1@blaine.gmane.org>
	<10517.1551372290@sss.pgh.pa.us>
	<CAHOFxGpW7JkX8HGW4MFFrSagCdW08yM-DK1jZvRJnj7dp84m=A@mail.gmail.com>

Michael Lewis schrieb am 28.02.2019 um 21:23:
>     Yeah, because it's an exact datatype match while the core operator
>     is anyarray && anyarray which is not.
> 
> 
> Can you dumb down how to change the index or column type such that an
> index will be used for the && operator while intarray extension is
> installed? We have the intarray extension installed and I doubt that
> I can get it removed. I've added gin index on a column declared as
> type "integer array" and had expected the index to be used, but I did
> not test it yet since there is some bad data with NULLs stored as a
> value in the integer array and I am waiting on that data cleanup to
> be done before directly using && operator. I expect that when I do
> test it, I will be impacted by this same concern. It is simplest to
> change the column type from integer array to anyarray? Is there a con
> to doing so?

I see two options: create the gin index with the opclass provided by intarray:
    create index ... using gin (... gin__int_ops);

Or if you use the regular opclass for the GIN index, make sure to use the built-in operator,
e.g.: OPERATOR(pg_catalog.&&) instead of && or OPERATOR(pg_catalog.@>) instead of @>

Thomas




view thread (15+ messages)  latest in thread

Message-ID: <0adbbf65-d596-bb45-b58a-95e08517c699@gmx.net>
Permalink:  ../0adbbf65-d596-bb45-b58a-95e08517c699@gmx.net/
Also on:    postgresql.org/message-id/0adbbf65-d596-bb45-b58a-95e08517c699@gmx.net

 · 

reply

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: spam_eater@gmx.net
  Subject: Re: Overloaded && operator from intarray module prevents index usage.
  In-Reply-To: <0adbbf65-d596-bb45-b58a-95e08517c699@gmx.net>
  References: <q583lv$5t8m$1@blaine.gmane.org> <10517.1551372290@sss.pgh.pa.us> <CAHOFxGpW7JkX8HGW4MFFrSagCdW08yM-DK1jZvRJnj7dp84m=A@mail.gmail.com> <0adbbf65-d596-bb45-b58a-95e08517c699@gmx.net>

* 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