aspose file tools*
The moose likes JDBC and the fly likes effiiciency comparison while fetching rows from a tables or view build on top of them Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "effiiciency comparison while fetching rows from a tables or view build on top of them" Watch "effiiciency comparison while fetching rows from a tables or view build on top of them" New topic
Author

effiiciency comparison while fetching rows from a tables or view build on top of them

Pratibha Malhotra
Ranch Hand

Joined: Dec 21, 2003
Posts: 199
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!!"
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1134

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.
Rudy Dakota
Ranch Hand

Joined: Jul 27, 2002
Posts: 54
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: effiiciency comparison while fetching rows from a tables or view build on top of them