Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Using views inside a View
On Mon, 21 Feb 2005 17:54:58 +0100, Frank van Bortel wrote:
>> Of course there is a risk of writing queries that have lousy execution
>> plans. It seems to me that risk exists in 'plain' SQL as well as SQL
>> based on nesting of views.
>>
>
> No - I have the 'no views over views' as an Rule Of Thumb,
> unless good, proven reasons (explain!) are shown why, where
> and how.
>
> The whole problem is that a view with columns A, B, C, and D
> and aggregates all over may look as just what I want when I want
> select A, sum(B) group by A, D, but give a horrible plan.
> This is not clear as it would be from the "plain SQL" you are
> referring to.
>
> Especially when end-user ad hoc reporting tools are to be used...
Please correct my interpretation of your statement:
"Selecting from inappropriate views that do unnecessary work [relative to what is needed by the select] can lead to bad execution plans.
Therefore selecting from views is bad."
In some circumstances (such as publishing views to ad-hoc users) I can concur that data sources can be used inappropriately.
My take on that is it leads us into a philosophical, not technical, discussion (like the one about killers and guns), in which case I can agree with you.
FGB Received on Mon Feb 21 2005 - 11:36:44 CST