Re: index on ILIKE/LIKE - PostgreSQL 9.2

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: index on ILIKE/LIKE - PostgreSQL 9.2
Date: 2016-05-14 17:13:16
Message-ID: CAMkU=1xv0g6_5BnQCJV_JYFO4MBopZuPwAmRnd1+Qnv3FY7MLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, May 12, 2016 at 2:32 PM, Lucas Possamai <drum(dot)lucas(at)gmail(dot)com> wrote:

>> -> Bitmap Index Scan on "ix_jobs_trgm_gin"
>> (cost=0.00..335.64 rows=485 width=0) (actual time=3883.886..3883.886 rows=32
>> loops=1)
>> Index Cond: (("title")::"text" ~~* '%RYAN
>> WER%'::"text")
>> Buffers: shared hit=5945
>> Total runtime: 3945.554 ms

So it is not cold-cache or IO problems, but a CPU problem. Your query
only has 6 trigrams in it, and that is causing nearly 6000 buffer
hits. I'm guessing the " w" trigram is extremely common in your data
set. Anyway, you have some huge posting lists there, and they were
not dealt with very well in 9.2 or 9.3.

Cheers,

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Brusselback 2016-05-14 17:33:16 Re: Foreign key triggers
Previous Message Jeff Janes 2016-05-14 15:59:21 Re: Update or Delete causes canceling of long running slave queries