Re: Query hangs when getting too complex...

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Query hangs when getting too complex...
Дата
Msg-id 20011219061828.A70705-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Query hangs when getting too complex...  (Paulo Jan <admin@digital.ddnet.es>)
Список pgsql-general
>     SELECT count(idarchivo)  FROM archivos  WHERE
>     revision <= 3 AND (EXISTS
>     (SELECT idarchivo FROM archivos_fulltext_en WHERE revision <= 3
>     AND archivos_fulltext_en.idarchivo=archivos.idarchivo
>     AND LOWER(TRANSLATE(archivos_fulltext_en.title ||
> archivos_fulltext_en.description || archivos_fulltext_en.place ||
> archivos_fulltext_en.province || archivos_fulltext_en.state ||
> archivos_fulltext_en.country || archivos_fulltext_en.race ||
> archivos_fulltext_en.sex || archivos_fulltext_en.class ||
> archivos_fulltext_en.tesauro_en, '[����������]', '[aeiouAEIOU]')) LIKE
> '%actress%'))
>     AND idsexo=2 AND archivos.joven = 1 AND posado=1
>     AND fechafoto BETWEEN '01/1/1976' AND '19/12/2001'

That's wierd. What does explain show for the query?

BTW: If you're always using the archivos_fulltext_en values like the above
and inserts/updates are less frequent than these selects, you might want
to do a trigger that does the lower(translate()) for you when the rows are
added.
As an additional note, I don't think the query above does what you want in
any case unless there are delimiters at the beginings or end of the
strings you're concatenating, and if any of the strings is null the result
of the concatenation is null. (Imagine that description ends in act and
place starts with ress for example)



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

Предыдущее
От: Joe Koenig
Дата:
Сообщение: Re: Way to use count() and LIMIT?
Следующее
От: Troy.Campano@LibertyMutual.com
Дата:
Сообщение: Outputting select into file.