Re: [PERFORM] query not using GIN index

2015-08-24 Thread Jeff Janes
On Mon, Aug 24, 2015 at 8:18 AM, Guo, Yun wrote: > > > From: Jeff Janes > Date: Friday, August 21, 2015 at 10:44 PM > To: Yun > Subject: Re: [PERFORM] query not using GIN index > > On Fri, Aug 21, 2015 at 6:55 PM, Guo, Yun wrote: > >> Hi, >> >> We

Re: [PERFORM] query not using GIN index

2015-08-24 Thread Guo, Yun
Hi Tom, Thanks for you valuable input. >Hi, > >On 08/22/2015 03:55 AM, Guo, Yun wrote: >> Hi, >> >> We have a query on a column with GIN index, but query plan chooses not >> using the index but do an seq scan whichi is must slower >> >> CREATE INDEX idx_access_grants_on_access_tokens ON access

Re: [PERFORM] query not using GIN index

2015-08-24 Thread Guo, Yun
Hi Tom, Thanks for you valuable input. You¹re right, the plan was coming from explain analyze SELECT "access_grants".* FROM "access_grants² WHERE (access_tokens @> ARRAY['124e5a1f9de325fc176a7c89152ac734']) limit 1; We tried removing "limit 1², which did give us the benefit of using index for some

Re: [PERFORM] query not using GIN index

2015-08-21 Thread Tomas Vondra
Hi, On 08/22/2015 03:55 AM, Guo, Yun wrote: Hi, We have a query on a column with GIN index, but query plan chooses not using the index but do an seq scan whichi is must slower CREATE INDEX idx_access_grants_on_access_tokens ON access_grants USING gin (access_tokens); explain analyze SELECT "a

[PERFORM] query not using GIN index

2015-08-21 Thread Guo, Yun
Hi, We have a query on a column with GIN index, but query plan chooses not using the index but do an seq scan whichi is must slower CREATE INDEX idx_access_grants_on_access_tokens ON access_grants USING gin (access_tokens); explain analyze SELECT "access_grants".* FROM "access_grants" WHERE