Re: Seemingly identical queries run at different speeds

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Seemingly identical queries run at different speeds
Дата
Msg-id 20030724233643.GE13026@dcc.uchile.cl
обсуждение исходный текст
Ответ на Seemingly identical queries run at different speeds  (VanL <vlindberg@verio.net>)
Список pgsql-general
On Tue, Jul 22, 2003 at 05:27:37PM -0600, VanL wrote:

> I have three queries that are essentially identical.  Two of them run in
> fractions of a second; one of them takes longer than 15 minutes to
> return. (Not sure how long it totally takes, that has been the limit of
> my patience.)
>
> The only difference between these queries is the use of table aliases in
> the sql query.  What is happening in postgres that this makes such a
> difference?

I think the third query is adding items to the FROM clause that you
probably don't want.  The result is a cartesian product, which is going
to take eons to materialize (i.e. give results back).

See:
http://www14.us.postgresql.org/docs/7.3/static/sql-select.html#R2-SQL-SELECT-4

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)

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

Предыдущее
От: "Terence Chang"
Дата:
Сообщение: Can I turn the case sensitive off
Следующее
От: Arguile
Дата:
Сообщение: Re: Can I turn the case sensitive off