Re: GIN index not used - Mailing list pgsql-performance

From Huang, Suya
Subject Re: GIN index not used
Date
Msg-id D83E55F5F4D99B4A9B4C4E259E6227CD014C32C9@AUX1EXC01.apac.experian.local
Whole thread Raw
In response to Re: GIN index not used  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: GIN index not used  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
-----Original Message-----
From: Tom Lane [mailto:tgl@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 <akretschmer@spamfence.net> writes:
> Huang, Suya <Suya.Huang@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
usinggin (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
seeyou've got enable_seqscan turned off.)
 

            regards, tom lane






Just found out something here http://www.postgresql.org/message-id/17021.1234474178@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.

pgsql-performance by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: GIN index not used
Next
From: Tom Lane
Date:
Subject: Re: GIN index not used