Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 Performance Tuning
»
Materialized Views
Materialized Views
Rate Topic
Display Mode
Topic Options
Author
Message
U.T
U.T
Posted Wednesday, July 30, 2008 12:31 PM
SSC Veteran
Group: General Forum Members
Last Login: Thursday, February 21, 2013 4:35 PM
Points: 224,
Visits: 407
One of my query is using 4-5 tables using Inner or Left Outer joins.
These tables are the main tables of the Db and contains alot of data. Also multiple user & multiple applications are inserting data in these tables as well. So will a materialized view by joining these 4-5 tables will give any performance benefit? Or it will be even more overhead?
Thanks,
Usman
Post #543805
GSquared
GSquared
Posted Wednesday, July 30, 2008 1:03 PM
SSCoach
Group: General Forum Members
Last Login: Yesterday @ 1:45 PM
Points: 15,442,
Visits: 9,572
It depends.
If you have a lot of selects on certain conditions, then a materialized view based on those conditions can increase performance for those selects.
On the other hand, materialized views, like any index, do slow down insert/update/delete operations.
In many cases, the slight slow-down on those is worth the large speed-up on selects, but this requires doing some research and making sure the view is exactly what you need.
Used correctly, a materialized view can speed up lots of things. Used poorly, they can slow down lots of things.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #543842
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Wednesday, July 30, 2008 2:23 PM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 5:37 PM
Points: 31,521,
Visits: 13,855
I tend to agree with the views expressed above. It can be a useful tool, if you consider the load on your system for Ins/Upd/Del
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #543903
Jeff Moden
Jeff Moden
Posted Wednesday, July 30, 2008 7:44 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 12:10 AM
Points: 33,108,
Visits: 27,030
usman.tanveer (7/30/2008)
One of my query is using 4-5 tables using Inner or Left Outer joins.
These tables are the main tables of the Db and contains alot of data. Also multiple user & multiple applications are inserting data in these tables as well. So will a materialized view by joining these 4-5 tables will give any performance benefit? Or it will be even more overhead?
Thanks,
Usman
I believe that a materialized view will cause you a world of hurt
in this particular case
because of all the inserts you say you'll be doing.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #544016
GSquared
GSquared
Posted Monday, August 04, 2008 7:56 AM
SSCoach
Group: General Forum Members
Last Login: Yesterday @ 1:45 PM
Points: 15,442,
Visits: 9,572
Jeff Moden (7/30/2008)
usman.tanveer (7/30/2008)
One of my query is using 4-5 tables using Inner or Left Outer joins.
These tables are the main tables of the Db and contains alot of data. Also multiple user & multiple applications are inserting data in these tables as well. So will a materialized view by joining these 4-5 tables will give any performance benefit? Or it will be even more overhead?
Thanks,
Usman
I believe that a materialized view will cause you a world of hurt
in this particular case
because of all the inserts you say you'll be doing.
It depends. It will slow down the inserts, but if those are generally single-table, single-row inserts, the performance hit on that might be negligible. What isn't mentioned is what queries the view will be supporting.
Even with lots of inserts, you can still have a net gain if you have a lot of complex queries that are called frequently.
I've even had a net gain in insert speed in one case, because of an indexed view that was used by those inserts (Insert...Select). Slowed down the insert part, but gained even more from the select part. (Supported complex business rules in an upsert situation.) Went from 600 ms to 40 ms on a common transaction in that database.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #546102
Jeff Moden
Jeff Moden
Posted Monday, August 04, 2008 7:33 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 12:10 AM
Points: 33,108,
Visits: 27,030
Actually, Gus' answer is the best answer... "It depends". This is the kind of thing that you need to test.
Gus, good point about the net gain on things like Insert/Select. :)
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #546458
Hossam AlFraih
Hossam AlFraih
Posted Tuesday, April 12, 2011 7:00 AM
Grasshopper
Group: General Forum Members
Last Login: Sunday, June 02, 2013 11:42 PM
Points: 12,
Visits: 76
Indexed Views will helps by pre-computing aggregations and store them in the index. Moreover, joining tables can be pre-join and results data can be stored.
This can speed up your queries by approx. 50-75% in general.
But remember, it always depends!
Good luck.
Post #1092039
Patibandla
Patibandla
Posted Tuesday, August 21, 2012 5:41 AM
SSC Rookie
Group: General Forum Members
Last Login: Friday, June 07, 2013 8:41 AM
Points: 35,
Visits: 144
It is truly not suggestible to use an Indexed View when the tables are highly transactional as you mentioned. But if the priority is reporting then you can use the materialized views with NOLOCK on the Tables.
Post #1347724
Patibandla
Patibandla
Posted Tuesday, August 21, 2012 5:47 AM
SSC Rookie
Group: General Forum Members
Last Login: Friday, June 07, 2013 8:41 AM
Points: 35,
Visits: 144
Rather you should keep in mind that you will not be allowed to do any properties that affect the deterministic nature of an indexed view like full-text predicates or references to other views aggregation operations etc..
Post #1347726
Lynn Pettis
Lynn Pettis
Posted Tuesday, August 21, 2012 8:16 AM
SSC-Insane
Group: General Forum Members
Last Login: Yesterday @ 3:27 PM
Points: 21,832,
Visits: 27,845
I am going to join in with the "It depends" group. You need to test if a materialized view is going to help or not. There really is no definative answer here.
Test it, and let us know if it helped or hindered you in this situation.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #1347817
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.