|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 8:14 AM
Points: 2,555,
Visits: 7,214
|
|
striker-baba (4/23/2010) I tried to query the fragmentation stats on that table. using
SELECT a.index_id, name, avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats (DB_ID(' DB '),OBJECT_ID(' Table'A' '),NULL, NULL, NULL) AS a JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;
but the query is taking tooo long..... I checked activity monitor. and it has IX locks on that table and the wait time is 2955150046.
Is there any other place where I can look for some information.
Can you run that during off-hours ? If you're doing a lot of inserts, maybe you should just rebuild indexes anyway ?
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Thursday, April 25, 2013 1:40 AM
Points: 498,
Visits: 262
|
|
Sanjay Rohra (4/23/2010) If you run all the jobs that are going to insert data into Table A in parallel, there will definitely be blocking and it might also lead to deadlock causing your jobs to be terminated by the SQL engine. If possible, execute those jobs sequentially. Once done, check for fragmentation and do a re-org or rebuild of indexes.
Just to add to my point, since there are multiple inserts daily, your indexes will definitely fragment out. You will have to rebuild them anyway. You can still cross-check the level of fragmentation by querying the sys.dm_db_index_physical_stats DMV, but do that only when there are no Inserts currently happening in your table.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 7:35 PM
Points: 72,
Visits: 355
|
|
Thanks to all for the replies.
I ran the query SELECT a.index_id, name, avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats (DB_ID(' dbname '),OBJECT_ID(' table a '),NULL, NULL, 'limited') AS a JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;
and I have 5 indexes on my table and all 3 indexes are 96% fragmented and 2 of them are 66% fragmented.
I am planning to archive the data and rebuild the indexes on that table.
DO you guys think this will work out .... or Any suggestions.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 8:14 AM
Points: 2,555,
Visits: 7,214
|
|
striker-baba (4/23/2010) Thanks to all for the replies.
I ran the query SELECT a.index_id, name, avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats (DB_ID(' dbname '),OBJECT_ID(' table a '),NULL, NULL, 'limited') AS a JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;
and I have 5 indexes on my table and all 3 indexes are 96% fragmented and 2 of them are 66% fragmented.
I am planning to archive the data and rebuild the indexes on that table.
DO you guys think this will work out .... or Any suggestions.
That should be an improvement.
|
|
|
|