September 9, 2010 at 1:50 am
Hello there,
I wonder if there is any performance difference between querying a huge single view or multiple broken down views? ( both totalling same number rows ) As I usually notice that only 50% of CPU usuage will be in use by SQL server on a query. If views are spread in multiple, then it take multiple query to retrive data from multiple views. Would this overcome any resource constraint if there is any?
I m using SQL server 2005 SP3 and windows 2003 standard
September 9, 2010 at 2:13 pm
The performance is based on what is happening with the base tables. Whether the views are wide or narrow isn't as important as what operations the query plan will perform on the base tables when using the views. If you can provide more background or specific information I might be able to give you a more indepth answer. I am not sure what a broken down view is - a view with fewer columns?
September 9, 2010 at 2:43 pm
I agree with Tony. SQL Server breaks down the query in views and attempts to build a tree just as if you had embedded the view code in the FROM clause of your query.
September 9, 2010 at 3:58 pm
Is this a theoretical question or do you have to deal with a real-world scenario?
If the latter, you could test the effect by using two scenarios and compare the execution plan as well as statistics.
Based on the query design you might get identical execution plans. Or not. 😉 It depends.
September 9, 2010 at 4:30 pm
I tend to use "Divide'n'Conquer' methods. Unfortunately, those methods rarely include views... just queries within stored procedures.
I also tend to avoid views with aggregates because people do some terrible things like trying to filter on the aggregated columns using WHERE clauses. When it takes an hour to return the top 10 from a view, you know you've really done something wrong.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 10, 2010 at 3:31 am
Thanks ppl .
Views generated from both approaches are from same set of tables ( over 100 ) and
they are not partitioned. They are generated by some stored procedures on monthly update of master data. These tables will be queried by reporting server (business objects) with requests on views containing about 20 tables each time. If i have a single view, i can manage the access right more easily ( filterd at row level by WHERE statement in reporting server ). If in 6 views, I would be managing 6 stored procedure and 6 set of access rights.
Cheers. Definitely will try out the above suggestions.
September 10, 2010 at 6:33 am
clementstore (9/10/2010)
Thanks ppl .Views generated from both approaches are from same set of tables ( over 100 ) and
they are not partitioned. They are generated by some stored procedures on monthly update of master data. These tables will be queried by reporting server (business objects) with requests on views containing about 20 tables each time. If i have a single view, i can manage the access right more easily ( filterd at row level by WHERE statement in reporting server ). If in 6 views, I would be managing 6 stored procedure and 6 set of access rights.
Cheers. Definitely will try out the above suggestions.
The code that builds the views will easily manage the permissions because the code should be using simple ALTER commands to modify the views. The views sound like they're simple "partitioned views" and having multiple partitioned views is a time honored way of managing data for performance. Having one BIG view for such a thing may not be the way to go because partitioned views don't always work out the way folks want them to.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply