Re: Weird query plans for my queries, causing terrible performance.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Weird query plans for my queries, causing terrible performance.
Дата
Msg-id 8771.1044027032@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Weird query plans for my queries,  (Arjen van der Meijden <acm@tweakers.net>)
Список pgsql-general
Arjen van der Meijden <acm@tweakers.net> writes:
> That is weird, a copy&paste of your command into my psql results in:
> [different results]

Hm, there must be some difference on this query between 7.3 and CVS tip
then; I was not expecting that.  [ ... a debugger is fired up ... time
passes ... ]

Ah hah.  There's a rather shaky heuristic in canonicalize_qual that
prefers DNF if certain things are true, one of them being that the
qual condition mentions only one relation.  This test is being fooled
because you wrote some of the variables with "F_Topics." and some
without (which means that, according to the letter of the SQL spec,
they refer to the join relation's result and not the original table).
I find that 7.3 will produce the desired plan if I write all the
variables in the WHERE clause the same way, either with or without
"F_Topics.".  CVS tip doesn't show this effect because it handles join
variables differently.

So that's your workaround for the moment.  As I was saying, this code
could use some fresh ideas...

            regards, tom lane

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

Предыдущее
От: Joep DeVocht
Дата:
Сообщение: Clearing tables questions
Следующее
От: Arjen van der Meijden
Дата:
Сообщение: Re: Basic SQL join question