-----Original Message----- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Friday, July 11, 2014 2:56 PM To: Andreas Kretschmer Cc: Huang, Suya; pgsql-performance@postgresql.org Subject: Re: [PERFORM] GIN index not used
Andreas Kretschmer <akretsch...@spamfence.net> writes: > Huang, Suya <suya.hu...@au.experian.com> 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 Just found out something here http://www.postgresql.org/message-id/17021.1234474...@sss.pgh.pa.us So I dropped the index and recreate it by specifying: using gin(terms_ts gin__int_ops) and the index works. My PG version is 9.3.4, none-default planner settings: enable_mergejoin = off enable_nestloop = off enable_seqscan is turned off for session while trying to figure out why the GIN index is not used. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance