Table order at FROM clause affects performance?

Поиск
Список
Период
Сортировка
От Eduard Català
Тема Table order at FROM clause affects performance?
Дата
Msg-id CAL54xNYE38bzJGKWbhAe3g_36yc8HNLhxwPJRqs85qdKGAxEmQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Table order at FROM clause affects performance?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
I have a strange performance issue, i think that is not possible:

Given this statement:

SELECT several_fields  FROM A, B, C WHERE  conditions
A, B are tables with several LEFT JOINS but they act as one subquery.

If I execute the select above:

SELECT several_fields  FROM A, B, C WHERE  conditions
Time: 30 secs
Cost: 1M


If I execute the same select (same parameters) but swapping A and B in the from clause:

SELECT several_fields  FROM B, A, C WHERE  conditions
Time: 19ms

Cost: 10k

The plan changes dramatically: I can't see why the order of FROM clause impacts directly on the query cost and plan. If this is possible, where i can read about it? I need to know how the order of FROM clause modifies the query plan.

Thanks in advance. This is my first post.

Eduard Català






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

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Re: Latest advice on SSD?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Table order at FROM clause affects performance?