index on search - pg 9.2

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: index on search - pg 9.2
Date: 2017-03-15 02:18:36
Message-ID: CAJNY3itPEvqoNat4zh4Lvwf5iqP_b+7hcoTfSK-EyDnfbpJH3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys

I've got a query that is doing a search with wildcards:

> OR (description LIKE '%change%')

Query: - Taking > 14 secs to run

> SELECT j.id, ff.gtime
> FROM public.status AS s
> JOIN public.job AS j ON j.status_label_id = s.id AND j.clientid = 3369
> JOIN public.log AS ff ON ff.jobid = j.id
> AND ff.clientid = 3369
> AND (ff.description LIKE '%change%')
> ORDER BY gtime DESC
> LIMIT 100

Explain analyze: https://explain.depesz.com/s/1OLW

I'm using PG 9.2 and, read about gin indexes.
I've created the index to test, but the query is not using it.

> create index on log gin (description gin_trgm_ops)

Can you guys help to improve that part please?

Patrick.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2017-03-15 03:23:36 Re: index on search - pg 9.2
Previous Message Peter Geoghegan 2017-03-14 23:24:15 Re: UPDATE ... ON CONFLICT DO NOTHING