Re: full text search index
| От | Kevin Grittner |
|---|---|
| Тема | Re: full text search index |
| Дата | |
| Msg-id | CACjxUsOVzpw9X0zOmBq8ybfZECsMkPXjhLpVQTNUPDRiEWm2mw@mail.gmail.com обсуждение исходный текст |
| Ответ на | full text search index (Patrick Baker <patrickbakerbr@gmail.com>) |
| Список | pgsql-general |
You don't provide much context, like PostgreSQL version or machine characteristics. https://wiki.postgresql.org/wiki/SlowQueryQuestions On Wed, May 25, 2016 at 11:04 PM, Patrick Baker <patrickbakerbr@gmail.com> wrote: >> SELECT COUNT(DISTINCT j0_.id) AS sclr10 >> FROM customers j0_ >> WHERE ((LOWER(j0_.name_first) LIKE '%some%' >> OR LOWER(j0_.name_last) LIKE '%some%') >> AND j0_.id = 5) >> AND j0_.id = 5 > > The query is taking ages to run. > > I read about wildcards and it seems I have to use a function with > to_tsvector ? I very much doubt that full text search is going to be helpful here -- perhaps trigrams with an appropriate gist or gin index could help. Depending on table sizes and data present, picking out rows based on the OR of scanning for a sequence of characters in a couple character string columns might not be your fastest query to run. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-general по дате отправления: