pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Subject: Re: int2vector and btree indexes
Date: Tue, 11 Oct 2016 08:40:41 -0400
Message-ID: <19767.1476189641@sss.pgh.pa.us> (raw)
In-Reply-To: <4a14479b-0602-5f09-bd79-983069e7453f@lab.ntt.co.jp>
References: <d9bb74f8-b194-7307-9ebd-90645d377e45@lab.ntt.co.jp>
	<4a14479b-0602-5f09-bd79-983069e7453f@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
> 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.

Hmm ... I kind of wonder why we have int2vectoreq or hashint2vector at
all, likewise the hash opclass based on them.  The code says that they
are needed to support catcache index columns, but the only columns of
this type are

regression=# select attrelid::regclass,attname from pg_attribute where atttypid = 'int2vector'::regtype;
  attrelid  |  attname  
------------+-----------
 pg_index   | indkey
 pg_index   | indoption
 pg_trigger | tgattr
(3 rows)

and those don't have indexes at all, let alone catcaches based on them.
So it looks to me like we could remove this infrastructure.  There is
value in being able to hash int2vectors during queries, for sure, but
we could let that be done by the anyarray hash opclass.

Having said that, int2vector is not meant as a user-facing type and so
I don't particularly care whether indexes built on it work conveniently.
But it looks to me like we've got some unnecessary code here.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (5+ messages)  latest in thread

Message-ID: <19767.1476189641@sss.pgh.pa.us>
Permalink:  ../19767.1476189641@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19767.1476189641@sss.pgh.pa.us

 · 

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Langote_Amit_f8@lab.ntt.co.jp
  Subject: Re: int2vector and btree indexes
  In-Reply-To: <19767.1476189641@sss.pgh.pa.us>
  References: <d9bb74f8-b194-7307-9ebd-90645d377e45@lab.ntt.co.jp> <4a14479b-0602-5f09-bd79-983069e7453f@lab.ntt.co.jp> <19767.1476189641@sss.pgh.pa.us>

* 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