Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


index scan vs seek


index scan vs seek

Author
Message
Snargables
Snargables
SSC Veteran
SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)

Group: General Forum Members
Points: 271 Visits: 709
i have a table that has 600 mill recs. i have an update to it that modifies 79 k records a day. Up to last saturday at 8am this process ran in 20-30 mins. Now it's taking 3 hours. I defraged the index it's using because it was fraged 40 %. I just updated stats. Is there anything else i should do?
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16632 Visits: 17024
Snargables (10/11/2013)
i have a table that has 600 mill recs. i have an update to it that modifies 79 k records a day. Up to last saturday at 8am this process ran in 20-30 mins. Now it's taking 3 hours. I defraged the index it's using because it was fraged 40 %. I just updated stats. Is there anything else i should do?


Can you post the actual execution plan? That is the first place to start.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Snargables
Snargables
SSC Veteran
SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)

Group: General Forum Members
Points: 271 Visits: 709
attached plan
Attachments
execPlan.sqlplan (17 views, 256.00 KB)
Snargables
Snargables
SSC Veteran
SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)

Group: General Forum Members
Points: 271 Visits: 709
actually. thats the estimated exe plan
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45241 Visits: 39927
Snargables (10/11/2013)
i have a table that has 600 mill recs. i have an update to it that modifies 79 k records a day. Up to last saturday at 8am this process ran in 20-30 mins. Now it's taking 3 hours. I defraged the index it's using because it was fraged 40 %. I just updated stats. Is there anything else i should do?


Yes... if the UPDATE are causing individual rows to grow, you need to consider the fill factor of each index (especially the clustered index). If it's 0 or 100%, you'll need to change it to help prevent page and extent splits.

--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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
TheSQLGuru
TheSQLGuru
SSCertifiable
SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)

Group: General Forum Members
Points: 5998 Visits: 8314
Snargables (10/11/2013)
i have a table that has 600 mill recs. i have an update to it that modifies 79 k records a day. Up to last saturday at 8am this process ran in 20-30 mins. Now it's taking 3 hours. I defraged the index it's using because it was fraged 40 %. I just updated stats. Is there anything else i should do?


That is a sufficiently small fraction such that the most efficient way to do the update is with an index seek. Ensure whatever column(s) you use to interrogate the base table on for the update has a non-clustered index on it/them (or the clustered index if it matches already) and it should be very efficient and fast. If the index exists and IS being used then check for blocking with sp_whoisactive. If the index exists but is NOT being used - force it with a hint.

Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Bhuvnesh
Bhuvnesh
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2928 Visits: 4076
Snargables (10/11/2013)
Up to last saturday at 8am this process ran in 20-30 mins. Now it's taking 3 hours.
obviuosly kevin ans sean will give here better idea
something from my side too
sudden performance degrade happens because of sudden activity happened prior. like data migration, cache clean. dropping any index (or even statistics)

any idea if something had happened ?

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Snargables
Snargables
SSC Veteran
SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)

Group: General Forum Members
Points: 271 Visits: 709
figured i'd close the loop on this one. The issue started a week ago. the update wouldnt do an index seek which i assume it was doing before because it ran considerably faster. Regardless i noticed the index was at 40% fragmentation. i also noticed it was automatically defraged a few hours before all my issues started.

So i defraged the indexs. but still could only get the proc to use a seek if i rewrote the update. I didn't have a problem doing that however really wanted to know what caused the issue. Nonetheless, once the weekend hit i rebuilt the clustered then the nonclustered the updatre was using. i instantly noticed the update using the index seek. It went from 3 hours to 9 mins with this mornings run. The process ended up failing down the line anyhow do a different step growing the tran log so large we ran out of space on a drive. It's like the wild west around here. One thing at a time please

thanks for your help
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