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 ««12

Performance issue due to index fragmentation. Expand / Collapse
Author
Message
Posted Friday, April 23, 2010 2:45 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 9:00 PM
Points: 2,828, Visits: 8,474
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 ?



Post #909820
Posted Friday, April 23, 2010 2:50 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 6:36 AM
Points: 539, Visits: 275
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.
Post #909824
Posted Friday, April 23, 2010 4:04 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, August 14, 2014 10:53 AM
Points: 72, Visits: 456
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.
Post #909849
Posted Sunday, April 25, 2010 8:21 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 9:00 PM
Points: 2,828, Visits: 8,474
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.



Post #910163
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse