2006 Oct 16 5:17 PM
Hi
Can you please tell me why Views are faster than Database Joins?
Thanks
Hi
Can you please tell me why Views are faster than Database Joins?
Thanks
2006 Oct 16 6:46 PM
2006 Oct 16 8:37 PM
Your statement is a generalization and is not always true.
But note this:
Views might be cached by application servers, joins are always accessed by database directly.
2006 Oct 17 7:17 AM
Then why do we prefer to create views and not Joins..
I think there has to be some reason for the views to be faster than using SELECT by JOINS..
Thanks
2006 Oct 17 7:22 AM
If you are going to use a specific join and this will be used by your entire team, I would rather create a view and use the view rather than using the join every time, it becomes a reusable component, right?
As fast as speed is concerned, I don't think it can be generalized.
Regards,
Ravi
2006 Oct 17 1:45 PM
Subhash,
"Then why do we prefer to create views and not Joins"
Who prefers to create views over joins? Your company?
You and your company may have development standards that they want you to follow; however, on an overall stance, you need to create whatever "fits your need."
VIEWS behave like reuseable data objects. Other developers no longer need to know the details of numerous tables to combine data between them.
JOINS are standalone SQL statements. They have no formal reuseability.
Knowing these facts (and if your company DOES NOT have developments in this area), make your own choice as a case-by-case basis.
Don't forget to reward points for menaingful answers. Thanks.
2006 Oct 17 2:41 PM
Also -
"I think there has to be some reason for the views to be faster than using SELECT by JOINS.."
As stated above-Views might be cached by application servers, joins are always accessed by database directly.
IF the VIEW's results are cached/stored on the app server, then the next request for this same info will certainly be faster.
Has your question been answered?
Please don't forget those points... or clarify your question further. Thanks in advance.