From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(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: gin index postgres 9.2 |
Date: | 2016-05-25 23:29:26 |
Message-ID: | CAKFQuwari142yDabQrLG2zSb+OCZU7yTD8g=QOkefPpkiEz8KQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, May 25, 2016 at 6:34 PM, Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
wrote:
> I've got the following query:
>
> SELECT COUNT(DISTINCT j0_.id) AS sclr0FROM ja_customers j0_WHERE ((LOWER(j0_.name_first) LIKE '%asd%'
> OR LOWER(j0_.name_last) LIKE '%asd%'
> OR LOWER(j0_.company) LIKE '%asd%'
> OR LOWER(j0_.phone) LIKE '%asd%'
> OR LOWER(j0_.mobile) LIKE '%asd%')
> AND j0_.deleted = 'f'
> AND j0_.clientid = 2565)
> AND j0_.clientid = 2565
>
> It returns: 3
>
> I created a GIN index;
>
> CREATE INDEX CONCURRENTLY ON public.ja_customers USING gin (name_first gin_trgm_ops, name_last gin_trgm_ops, company gin_trgm_ops, phone gin_trgm_ops, mobile gin_trgm_ops);
>
> New query to hit the new index:
>
> SELECT COUNT(DISTINCT j0_.id) AS sclr0FROM ja_customers j0_WHERE j0_.name_first LIKE '%asd%'
> OR j0_.name_last LIKE '%asd%'
> OR j0_.company LIKE '%asd%'
> OR j0_.phone LIKE '%asd%'
> OR j0_.mobile LIKE '%asd%'
> AND j0_.deleted = 'f'
> AND j0_.clientid = 2565
> AND j0_.clientid = 2565
>
> It returns: 532
>
>
> The problem is that the new query returns different results...
>
> Please, what am I missing guys?
>
Parentheses?
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Lucas Possamai | 2016-05-25 23:38:15 | Re: gin index postgres 9.2 |
Previous Message | Lucas Possamai | 2016-05-25 22:34:02 | gin index postgres 9.2 |