Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X5Ssp-0005iu-6S for pgsql-performance@arkaria.postgresql.org; Fri, 11 Jul 2014 04:56:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X5Ssn-0004g1-8j for pgsql-performance@arkaria.postgresql.org; Fri, 11 Jul 2014 04:56:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X5Ssm-0004fr-5e for pgsql-performance@postgresql.org; Fri, 11 Jul 2014 04:56:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X5Sse-0000uU-WC for pgsql-performance@postgresql.org; Fri, 11 Jul 2014 04:56:27 +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 s6B4uEnq020681; Fri, 11 Jul 2014 00:56:14 -0400 From: Tom Lane To: Andreas Kretschmer cc: "Huang, Suya" , pgsql-performance@postgresql.org Subject: Re: GIN index not used In-reply-to: <20140711044452.GA7390@tux> References: <20140711044452.GA7390@tux> Comments: In-reply-to Andreas Kretschmer message dated "Fri, 11 Jul 2014 06:44:52 +0200" Date: Fri, 11 Jul 2014 00:56:14 -0400 Message-ID: <20680.1405054574@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Andreas Kretschmer writes: > Huang, Suya wrote: >> I’ve got a table with GIN index on integer[] type. While doing a query with >> filter criteria on that column has GIN index created, it’s not using index at >> all, still do the full table scan. Wondering why? > Btw.: works for me: Yeah, me too: regression=# create table booking_weekly(booking_ts int[]); CREATE TABLE regression=# create index on booking_weekly using gin (booking_ts); CREATE INDEX regression=# explain select * from booking_weekly where booking_ts@>array[2446685]; QUERY PLAN -------------------------------------------------------------------------------------------- Bitmap Heap Scan on booking_weekly (cost=8.05..18.20 rows=7 width=32) Recheck Cond: (booking_ts @> '{2446685}'::integer[]) -> Bitmap Index Scan on booking_weekly_booking_ts_idx (cost=0.00..8.05 rows=7 width=0) Index Cond: (booking_ts @> '{2446685}'::integer[]) Planning time: 0.862 ms (5 rows) What PG version is this? What non-default planner parameter settings are you using? (Don't say "none", because I can see you've got enable_seqscan turned off.) regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance