From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: int2vector and btree indexes |
Date: | 2016-10-11 08:37:31 |
Message-ID: | 4a14479b-0602-5f09-bd79-983069e7453f@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2016/10/11 15:58, Amit Langote wrote:
> If I create btree index on a int2vector column, it does not get used for
> queries because the query search always fails to match the index operator
> (family).
>
> During index creation, GetDefaultOpClass() returns array_ops for a
> int2vector index column, because type int2vector is binary-coercible with
> anyarray (which is array_ops's input type). Whereas queries involving
> int2vector columns would use a int2vector_ops operator.
I was wrong that the index *never* gets used. It does in fact get used if
the operator is an ordering search operator (<, <=, >, >=), in which case
the query would use an array_ops operator (which is a btree operator class
for type anyarray) and hence matches the index operator family. I failed
to mention in my original message that int2vector_ops is a hash operator
class. There is exactly one =(int2vector, int2vector) operator in the
system of which there is no btree equivalent.
I guess there is not much to complaint about here after all. Sorry about
the noise.
Thanks,
Amit
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2016-10-11 08:45:15 | Re: memory leak in e94568ecc10 (pre-reading in external sort) |
Previous Message | Pavel Stehule | 2016-10-11 08:00:07 | Re: proposal: schema PL session variables |