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 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