effiiciency comparison while fetching rows from a tables or view build on top of them
Joined: Dec 21, 2003
Hi What is more effiecient to fetch data --> a join of lets say 5 tables. --> a view build on top of these 5 tables. as per my info view is nothing but a created stored in DB and this query inturn fetch data from the tables only. kindly clarify...
~ Pratibha Malhotra<br /> <br />Sun Certified Java Programmer<br />SCEA 1.4 (In Progress)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"Many of life's failures are people who did not realize how close they were to success when they gave up!!"
Gunjan, In general, querying a view is slower than querying directly from the table(s). But in order to really know which is faster, I think you would need to record the time it takes in both cases. Good Luck, Avi.
Joined: Jul 27, 2002
Avi, Gunjan, A view is nothing but a select statement stored within the database. Views and queries should therefore not differ in the execution plan or the performance. One exception that comes to mind: views might be slightly more sensitive to sub-optimal formulation of search conditions, as the underlying query is abstracted from and thus likeley not known at all times. But that doesn't do away with the general rule: same execution plan, same performance. Good riding, Rudy.