Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

index scan vs seek Expand / Collapse
Author
Message
Posted Friday, October 11, 2013 10:40 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 10, 2014 9:12 AM
Points: 141, Visits: 332
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?
Post #1504088
Posted Friday, October 11, 2013 10:47 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:37 PM
Points: 11,965, Visits: 10,992
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)
Post #1504091
Posted Friday, October 11, 2013 11:15 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 10, 2014 9:12 AM
Points: 141, Visits: 332
attached plan

  Post Attachments 
execPlan.sqlplan (17 views, 256.93 KB)
Post #1504102
Posted Friday, October 11, 2013 11:16 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 10, 2014 9:12 AM
Points: 141, Visits: 332
actually. thats the estimated exe plan
Post #1504103
Posted Friday, October 11, 2013 3:24 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 10:59 AM
Points: 35,951, Visits: 30,239
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."

"Change is inevitable. Change for the better is not." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1504149
Posted Saturday, October 12, 2013 10:57 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 8:43 PM
Points: 4,128, Visits: 5,836
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
Post #1504241
Posted Sunday, October 13, 2013 6:18 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, March 14, 2014 2:19 AM
Points: 2,820, Visits: 3,916
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
Post #1504257
Posted Monday, October 14, 2013 9:12 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 10, 2014 9:12 AM
Points: 141, Visits: 332
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
Post #1504456
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse