SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Exceptionally slow row addition or modification on table associated to indexed view.


Exceptionally slow row addition or modification on table associated to indexed view.

Author
Message
Champagne Charly
Champagne Charly
SSC Rookie
SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)

Group: General Forum Members
Points: 47 Visits: 122
I have an index view (9M rows) based upon 2 cross joined tables.
The storage of the index is in filegroup and is not partitioned.
No pages aprox = 205k 60% full.

Creating the index took aprox 3mins.

Entering of data into the smaller table. takes around 3mins (just to change one date)
It seems clear that the reason for this grinding to a halt is that the index is being recreated as the data is being entered.
Is this the downside of indexed views or is there a way around this mass slowdown caused no doubt by the index recreation/ modification process from the transaction? Would partitioning help and if so to what degree? I have as yet not attempted and form of partitioning.

Any help would be appreciated. Thanks
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)SSC Guru (220K reputation)

Group: General Forum Members
Points: 220948 Visits: 42002
Champagne Charly (10/18/2013)
I have an index view (9M rows) based upon 2 cross joined tables.
The storage of the index is in filegroup and is not partitioned.
No pages aprox = 205k 60% full.

Creating the index took aprox 3mins.

Entering of data into the smaller table. takes around 3mins (just to change one date)
It seems clear that the reason for this grinding to a halt is that the index is being recreated as the data is being entered.
Is this the downside of indexed views or is there a way around this mass slowdown caused no doubt by the index recreation/ modification process from the transaction? Would partitioning help and if so to what degree? I have as yet not attempted and form of partitioning.

Any help would be appreciated. Thanks


If your index view is truly based on a CROSS JOIN, you're pretty much toast (and I've never heard of doing such a thing). Please verify that the view is actually based on a CROSS JOIN.

Regardless, it's actually a rare thing that partitioning actually helps with performance. The normal purpose of partitioning is to ease up on certain maintenance tasks and to make recovering a database in pieces possible.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
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.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Champagne Charly
Champagne Charly
SSC Rookie
SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)

Group: General Forum Members
Points: 47 Visits: 122
Thanks.. Seem like I'm toast then.

So if its flawed by design /cross join, where did i go wrong?
Basically what I want to achieve is a weekly snapshot of products and the associated storage costs Created from
how much was received (t1),
What went out (t2)
Storage rates for pack size(t3)
(cross join to) YEarWeek Calender T4
This creates a row/week/product.
I couldn't think of any way other than cross join to achieve this. Suggestions would be appreciated.
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)SSC Guru (97K reputation)

Group: General Forum Members
Points: 97667 Visits: 38989
The problem with giving you any suggestions at this point is we don't know enough to actually provide you with any viable alternatives. We can't see from here what you see there. We don't know your application, database structure, or data.

Cool
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)
Champagne Charly
Champagne Charly
SSC Rookie
SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)

Group: General Forum Members
Points: 47 Visits: 122
Understood.

I think I will just drop the index. So far the overhead of querying the view is not so great and data is returned within 400ms compared to 30ms with an index. I just like the performance effect of index and so use where possible. However in this case it doesn't pay off.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search