Re: GIN index not used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Tom Lane [mailto:tgl@xxxxxxxxxxxxx] 
Sent: Friday, July 11, 2014 2:56 PM
To: Andreas Kretschmer
Cc: Huang, Suya; pgsql-performance@xxxxxxxxxxxxxx
Subject: Re: [PERFORM] GIN index not used

Andreas Kretschmer <akretschmer@xxxxxxxxxxxxx> writes:
> Huang, Suya <Suya.Huang@xxxxxxxxxxxxxxx> 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.1234474178@xxxxxxxxxxxxx 

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.

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux