fuzzyocelot
Programmer
Hello everyone,
We’ve been having performance issues with one of our SQL 2005 servers. I’ve posted about it a few times in the past. It’s running on a Windows 2003 server (SP2) with 4 GB of RAM. We have SQL 2005 SP2 applied as well. This particular server is highly transactional as it uses merge replication with tablets. We’ve run performance counters on it and have optimized it the best we can (set awe, max server memory, etc). The vendor has also been monitoring it as well. The main conclusion we’re all coming to is that it’s maxed out on the memory and they need a more powerful server. So in the meantime, we’re trying to find ways of giving the server some “breathing” room. Since it also has other applications and SQL databases on it, we’re thinking of moving those to a separate server.
However, today I’m looking at index fragmentation and could use some help. We set up a 2005 maintenance plan to run weekly. Right now we have it set up to do the following:
* Check database integrity (include indexes)
* Reorganize index (tables and views, compact large objects)
* Update statistics (tables and views, all existing statistics, full scan)
* Clean up history (backup, job, maintenance plan, older than 12 weeks)
We’ve been wondering if it’s doing any good. So this morning I decided to do some research on it.
I queried the main database using sys.dm_db_index_physical_stats. The query I used is below:
I used Limited just to get an idea of what’s going on. If I’m reading the results correctly, it’s fragmented. The query returned 83 rows.
* The alloc_unit_type_desc shows IN_ROW_DATA for all 83 rows.
* The avg_fragmentation_in_percent varies between 50 and 99.
* The fragment_count ranges between 3 and 6600.
* The avg_fragment_size_in_pages is around 1 for all rows. From what I’ve been reading, combined with the high avg_fragmentation_in_percent, this isn’t good.
Am I reading into this right? Meaning, we have a problem with fragmentation on at least this database? If so, does anyone have any ideas what we can do? Do we need to rebuild the indexes instead of reorganizing them?
I’m still reading BOL and researching this as much as I can. I would appreciate any ideas.
Thanks!
We’ve been having performance issues with one of our SQL 2005 servers. I’ve posted about it a few times in the past. It’s running on a Windows 2003 server (SP2) with 4 GB of RAM. We have SQL 2005 SP2 applied as well. This particular server is highly transactional as it uses merge replication with tablets. We’ve run performance counters on it and have optimized it the best we can (set awe, max server memory, etc). The vendor has also been monitoring it as well. The main conclusion we’re all coming to is that it’s maxed out on the memory and they need a more powerful server. So in the meantime, we’re trying to find ways of giving the server some “breathing” room. Since it also has other applications and SQL databases on it, we’re thinking of moving those to a separate server.
However, today I’m looking at index fragmentation and could use some help. We set up a 2005 maintenance plan to run weekly. Right now we have it set up to do the following:
* Check database integrity (include indexes)
* Reorganize index (tables and views, compact large objects)
* Update statistics (tables and views, all existing statistics, full scan)
* Clean up history (backup, job, maintenance plan, older than 12 weeks)
We’ve been wondering if it’s doing any good. So this morning I decided to do some research on it.
I queried the main database using sys.dm_db_index_physical_stats. The query I used is below:
Code:
SELECT * FROM sys.dm_db_index_physical_stats(db_id('MAINDB'),NULL,NULL,NULL,'LIMITED')
WHERE avg_fragmentation_in_percent>50
I used Limited just to get an idea of what’s going on. If I’m reading the results correctly, it’s fragmented. The query returned 83 rows.
* The alloc_unit_type_desc shows IN_ROW_DATA for all 83 rows.
* The avg_fragmentation_in_percent varies between 50 and 99.
* The fragment_count ranges between 3 and 6600.
* The avg_fragment_size_in_pages is around 1 for all rows. From what I’ve been reading, combined with the high avg_fragmentation_in_percent, this isn’t good.
Am I reading into this right? Meaning, we have a problem with fragmentation on at least this database? If so, does anyone have any ideas what we can do? Do we need to rebuild the indexes instead of reorganizing them?
I’m still reading BOL and researching this as much as I can. I would appreciate any ideas.
Thanks!