Re: Query hangs when getting too complex...

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Paulo Jan <admin(at)mail(dot)ddnet(dot)es>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query hangs when getting too complex...
Date: 2001-12-19 14:25:17
Message-ID: 20011219061828.A70705-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Koenig 2001-12-19 14:44:23 Re: Way to use count() and LIMIT?
Previous Message Martijn van Oosterhout 2001-12-19 14:16:07 Re: Way to use count() and LIMIT?