Skip to Main Content
  • Questions
  • Use of views to provide consistent extraction of data

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Randall.

Asked: November 07, 2016 - 4:33 pm UTC

Last updated: November 11, 2016 - 5:22 am UTC

Version: Oracle Database 11g

Viewed 1000+ times

You Asked

Over the years, I have debated the proper use of views, and, almost without exception, developers are loathe to use them - especially Java developers. The number one reason for their argument is performance.

Two part question (Please forget about materialized views for now):

1) Is there a(any) valid reason(s) for NOT using views? In other words, is there any advantage to using queries over views? Whether it is because of performance, or whatever. This goes for updateable views as well as just select views.

2) Do these reasons for NOT using views outweigh the consistent extraction of data? For example, preventing a poorly performing query, or an invalid query (e.g., a query being written that fails to filter on most current effective date)?

The reason for ignoring materialized views is that I concede that there is overhead with complicated queries, whether it is in the form of a view, or a query, and creating materialized views is the only realistic response to this problem. Unfortunately, materialized views are a hard sale too since everyone in the reporting world wants a dimensional model -- which is another debate (e.g. Kimball vs Inmon).

and Connor said...

Is there a(any) valid reason(s) for NOT using views?

No. None.

A view is simple stored SQL. They are just like any other SQL, ie, a well written view works like well written SQL. A poorly written view runs like poorly written SQL.

2)

See (1). There are no reasons for not using views. Our EBR (edition based redefinition) facility put a view in front of every table, and we have huge corporations using EBR.

There is *no* issue with views.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Confirmation is good

Randall Shane, November 08, 2016 - 1:40 pm UTC

Thanks for your quick response. I asked the question for confirmation, and received it. However, I did not expect such a quick response.

Connor McDonald
November 09, 2016 - 2:00 am UTC

glad we could help

Valid reasons

Duke Ganote, November 10, 2016 - 9:02 pm UTC

Views and tables merely tools. The driving requirement is how complex and responsive do the queries need to be? For OLAP, transformations are usually massive and time-consuming; hence they're usually done overnight and materialized into (dimensional) tables. For OLTP, a view that provides a light dusting of semantic sugar is fine.

Is a tent better than a house? Well, it depends on what you need, what you can afford, and how flexible it must be.
Connor McDonald
November 11, 2016 - 5:22 am UTC

"Is a tent better than a house? Well, it depends on what you need, what you can afford, and how flexible it must be. "

That is a great metaphor!