Re: Slow views

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Slow views
Дата
Msg-id 20040716222210.D97991@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Slow views  (davidn-postgres@rebel.net.au)
Список pgsql-bugs
On Sat, 17 Jul 2004, David Newall wrote:

> On Sat, 2004-07-17 at 13:34, Tom Lane wrote:
> > I suspect the real issue is that the implied join order is not the same.
>
> With respect, the real issue is that using the view takes 100 times
> longer than not using it.
>
> > The view-based query is really
> >
> >     a LEFT JOIN (b LEFT JOIN c LEFT JOIN d LEFT JOIN e)
> >
> > while the allegedly equivalent hand expansion is
> >
> >     a LEFT JOIN b LEFT JOIN c LEFT JOIN d LEFT JOIN e
>
> Reversing the two terms, ie view right join table, gives the same (slow)
> result.  Adding a sub-select to the expansion, as Stephan said, gives

I think you're still fundamentally misunderstanding that the two queries
above are not always the same.  The reason you got better results from
your version is that a left join b was faster, however, if the join
conditions in your view were more complicated, your version would give the
wrong results. Unless/until we know for certain under what conditions we
can reorder the joins, we can't do so without causing bugs in other
queries.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Cannot recreate DB scheme using pg_dump
Следующее
От: "Alexander M. Pravking"
Дата:
Сообщение: Problems renaming referencing column