Re: Do Views offer any performance advantage?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Do Views offer any performance advantage?
Дата
Msg-id 11035.1050449826@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Do Views offer any performance advantage?  (Andreas Pflug <Andreas.Pflug@web.de>)
Ответы Re: Do Views offer any performance advantage?  (Andreas Pflug <Andreas.Pflug@web.de>)
Список pgsql-performance
Andreas Pflug <Andreas.Pflug@web.de> writes:
> Actually, there are cases when a view can impact performance.
> If you are joining a view, it seems to be treated as a subquery, that
> might have a much larger result than you would like.

> Imagine
> SELECT something
>   FROM A JOIN B JOIN C ...
>  WHERE A.primaryKeyFoo=1234 ...

>  where C is a view, containing JOINs itself, I observed a query plan
> (7.3.2) like
> A JOIN B JOIN (D JOIN E)
> instead of
> A JOIN B JOIN D JOIN E which would be much more efficient for the
> A.primaryKeyFoo restriction.

This is not the view's fault though --- the same would have happened
if you'd written explicitly

    FROM A JOIN B JOIN (D JOIN E)

7.4 will be less rigid about this (with or without a view ...)

            regards, tom lane


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

Предыдущее
От: Andreas Pflug
Дата:
Сообщение: Re: Do Views offer any performance advantage?
Следующее
От: "dex"
Дата:
Сообщение: Is there a performance between Inherits and Views?