Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the impact of creating unnecessary views on data base?

Status
Not open for further replies.

TekMem

Programmer
Jul 23, 2004
98
CA
What is the impact of creating unnecessary views on data base? Creating views makes my work easier.
Thanks.
 
If you are using views, how can you define them as unnecessary?

To my knowledge, a view doesn't affect the performance of the database much if at all. It may affect your applications ACCESSING the view, depending on the joins, associations, and indexes accessed when displaying the view. But I will quickly defer to any of the SQL gurus here. [smile]

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Here I am trying to add at least 16 columns in one of the row in a table to find out percentage. So I have created 16 views OTC1,OTC2...
in OTCn,OTCm I am getting percentage. Is there a way so that I create only one or two views?

Code:
CREATE OR REPLACE VIEW VEW_OTC1
(col1,col2) as
select 1  as col1,VARCHAR_255_17
from otc_env_main where to_date(VARCHAR_10_7,'mm-dd-yyyy')-to_date(VARCHAR_255_10,'mm-dd-yyyy') >60
union
select 0 as col1,VARCHAR_255_17
from otc_env_main where to_date(VARCHAR_10_7,'mm-dd-yyyy')-to_date(VARCHAR_255_10,'mm-dd-yyyy') <60

CREATE OR REPLACE VIEW VEW_OTC2
(col3,col4)as
select 1 as col2,VARCHAR_255_17
from otc_env_main where to_date(VARCHAR_10_1,'mm-dd-yyyy')-to_date(VARCHAR_255_11,'mm-dd-yyyy') >60
union
select 0 as col2,VARCHAR_255_17 
from otc_env_main where to_date(VARCHAR_10_1,'mm-dd-yyyy')-to_date(VARCHAR_255_11,'mm-dd-yyyy') <60


CREATE OR REPLACE VIEW VEW_OTCn
(col1,col3,col2)
AS select col1,col3,col4 from VEW_OTC1, VEW_OTC2,...
where col2=col4 and ...

CREATE OR REPLACE VIEW VEW_OTCm
(col1,col3,col2,sum,per)
AS select col1,col3,col2,(col1+col3),(col1+col3...)*100/16 from VEW_OTCn
 
Yes It is oracle but select statements should be similar.
 
It doesn't matter. There are a host of differences between the two databases. For example, I don't know how to do it in Oracle, but your expression to_date() with a format specifier won't be sargable. Consult the Oracle forum (there is one here!) about that.
 
You've also been pointed to the Oracle forum in previous posts you've made here. There is a reason for this - the syntax, functions and methods it uses are different to SQL Server.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top