Re: Query tuning help

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Query tuning help
Дата
Msg-id 200505081748.18362.josh@agliodbs.com
обсуждение исходный текст
Ответ на Query tuning help  (Dan Harris <fbsd@drivefaster.net>)
Список pgsql-performance
Dan,

>         and (  recordtext like '%RED%' or recordtext like '%CORVETTE%'  )  

It is simply not possible to use B-tree indexes on these kind of text queries.
B-trees require you to start at the "left" side of the field, because B-trees
locate records via <> tests.  "Anywhere in the field" text search requires a
Full Text Index.

> The reason for the redundant LIKE clause is that first, I only want
> those "incidentid"s that contain the words 'RED' and 'CORVETTE'.  BUT,
> those two words may exist across multiple records with the same
> incidentid.  Then, I only want to actually work with the rows that
> contain one of the words.  This query will repeat the same logic for
> however many keywords are entered by the user.  I have investigated
> text searching options and have not found them to be congruous with my
> application.

Sounds like you either need to restructure your application, restructure your
database (so that you're not doing "anywhere in field" searches), or buy 32GB
of ram so that you can cache the whole table.

--
Josh Berkus
Aglio Database Solutions
San Francisco

В списке pgsql-performance по дате отправления:

Предыдущее
От: Dan Harris
Дата:
Сообщение: Query tuning help
Следующее
От: Russell Smith
Дата:
Сообщение: Re: Query tuning help