Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btwMX-0006Ry-Sk for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Oct 2016 12:40:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btwMX-00083q-8x for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Oct 2016 12:40:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btwMV-000838-Sm for pgsql-hackers@postgresql.org; Tue, 11 Oct 2016 12:40:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btwMP-00073M-6y for pgsql-hackers@postgresql.org; Tue, 11 Oct 2016 12:40:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u9BCef4l019768; Tue, 11 Oct 2016 08:40:42 -0400 From: Tom Lane To: Amit Langote cc: pgsql-hackers@postgresql.org Subject: Re: int2vector and btree indexes In-reply-to: <4a14479b-0602-5f09-bd79-983069e7453f@lab.ntt.co.jp> References: <4a14479b-0602-5f09-bd79-983069e7453f@lab.ntt.co.jp> Comments: In-reply-to Amit Langote message dated "Tue, 11 Oct 2016 17:37:31 +0900" Date: Tue, 11 Oct 2016 08:40:41 -0400 Message-ID: <19767.1476189641@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Amit Langote 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