Author |
Topic  |
|
imtiazp
Starting Member
1 Posts |
Posted - 16 March 2006 : 17:22:32
|
Is it better to use tables instead of views that are build on some other views.
The final query returns only the count(*) by from the views.
In a nutshell, which is better option and why
select count(*) from view join someother views
select count(*) from table join someother table
Thanks Imtiaz |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 16 March 2006 : 17:40:58
|
Whenever you have the possibility to use tables, do that. Tables can have indexes which can contribute to a much better performance of a query. Even though the concept of a indexed view is supported in some DBs, I don't think it can be as effective as table indexing. Views are not a way to optimize performance, they have other purposes. So, IMO, go with tables whenever you can.
|
Snitz 3.4 Readme | Like the support? Support Snitz too |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 18 March 2006 : 19:25:26
|
This is where your problem starts :
quote: select count(*) from view join someother views
IF you can do it, make all the joins at once, in the view. Using your example code you are doing joins on joins on joins on joins ...... and the tables below that MAY be leading to the slow response times. Views ARE slower, but if you create a table then the data will not be completely up to date. Oracle has a new concept called a materialised view (MV) that acts like a view, but the data still resides on disk and is updated periodically.
Basically, either one is fine if you use it under the correct conditions. |
 |
|
|
Topic  |
|