Re: int2vector and btree indexes

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: int2vector and btree indexes
Дата
Msg-id 4a14479b-0602-5f09-bd79-983069e7453f@lab.ntt.co.jp
обсуждение исходный текст
Ответ на int2vector and btree indexes  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Ответы Re: int2vector and btree indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Torsten Zuehlsdorff
Дата:
Сообщение: Re: kqueue
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: memory leak in e94568ecc10 (pre-reading in external sort)