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 7:58 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:35 AM
Points: 74, Visits: 482
Hi all,

I have a table 'A' that gets new data inserted daily from different tables.

Today, all the jobs that populate the table 'A' are running very slow.
and If I try to query the table using select top 1 * from table'A' is also taking to much time. And the table had 5 indexes on it.

I think the table had its indexes freagmented.

I want to know how to check the fragmentation of all the indexes on that specific table and the ways to solve this problem.

Thanks in advance.
Post #909486
Posted Friday, April 23, 2010 8:10 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, December 11, 2014 6:43 PM
Points: 2,838, Visits: 8,570
What have you tried so far ? Have you searched for any information on the subject ?


Post #909506
Posted Friday, April 23, 2010 8:26 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:35 AM
Points: 74, Visits: 482
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.
Post #909524
Posted Friday, April 23, 2010 9:33 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, December 18, 2014 10:51 AM
Points: 1,639, Visits: 1,986
If the queries aren't completing I would check for blocking using Activity Monitor.
Post #909607
Posted Friday, April 23, 2010 9:41 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 11, 2014 11:23 AM
Points: 1,093, Visits: 2,620
You might want try running that dmv with the 'LIMITED' option:

FROM sys.dm_db_index_physical_stats (DB_ID(' DB '),OBJECT_ID(' Table'A' '),NULL, NULL, 'LIMITED')

as it will have better performance, specially if it is a big table.




_______________________________________________________________________
For better assistance in answering your questions, click here
Post #909619
Posted Friday, April 23, 2010 9:58 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:35 AM
Points: 74, Visits: 482
I did check in activity monitor for locks by process.
I found one of the job1 which inserts the data into table'A' is holding a
IX lock on the table.

this job1 is causing all the jobs from job2 to job 10 to wait.
but job1 has grant status.

So, Do I kill this job1 ?
but still job2 to job10 are going to perform the same insertions on the tableA.

So, Is that problem due to job or due to table A?

Post #909636
Posted Friday, April 23, 2010 10:06 AM
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: Thursday, November 20, 2014 5:18 AM
Points: 556, Visits: 277
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.
Post #909646
Posted Friday, April 23, 2010 10:10 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, December 18, 2014 10:51 AM
Points: 1,639, Visits: 1,986
If that process is blocking others you'll need to either find out why it's running so long or stop it.
Post #909647
Posted Friday, April 23, 2010 10:29 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, December 11, 2014 6:43 PM
Points: 2,838, Visits: 8,570
Richard M. (4/23/2010)
You might want try running that dmv with the 'LIMITED' option:

FROM sys.dm_db_index_physical_stats (DB_ID(' DB '),OBJECT_ID(' Table'A' '),NULL, NULL, 'LIMITED')

as it will have better performance, specially if it is a big table.


I was going to suggest that too, but I checked BOL and it says LIMITED is the defualt when NULL is specified, so it looks like that's already the case.



Post #909662
Posted Friday, April 23, 2010 10:33 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 11, 2014 11:23 AM
Points: 1,093, Visits: 2,620
... just realized that when I saw your post... :)
In any event, seems the OP has other issues at hand here....




_______________________________________________________________________
For better assistance in answering your questions, click here
Post #909667
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse