January 11, 2008 at 9:01 am
I run sys.dm_db_index_physical_stats daily on almost every server and db in our environment and have so for months. i've always noticed that anything higher than index_level 0 my fragmentation levels are pretty high.
i haven't seen any performance problems, but could never find any reason why this is so even the day after that index is rebuilt. does anyone have any idea?
January 11, 2008 at 11:25 am
Do you rebuild the index, or reorg it?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 11, 2008 at 11:29 am
we only do rebuilds since it saves us from doing an update statistics
we do alter index rebuild with (online = on) and once in a while drop and recreate it with create index
January 11, 2008 at 3:07 pm
how much free space is there in the database and what is the growth increment for the data file(s)?
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
January 11, 2008 at 3:27 pm
there is around 48GB free space in the db and file growth is set at 100MB. there is only one datafile because this is a replicated copy.
i think there was a bug in the alter index script i have because of some changes i made a while back. i'll see how it runs in the next few days
January 11, 2008 at 3:38 pm
48GB sounds like a lot - unless you only have a few massive tables in the database. Don't forget too that sp_spaceused (if that is what you used to determine free space) doesn't maintain accurate numbers. The usual culprit for failure-to-defrag is not having sufficient free space (usually due to poor size/growth increment control) in the database. Hopefully you DO have a bug and it simply hasn't been doing anything. :hehe:
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
January 11, 2008 at 5:51 pm
the database completely changes in data every 2-3 months as new billing data is added and old data is archived to a different server. one billing cycle is larger than the rest so this probably explains the free space.
and one table is pretty much the entire db with the other 10 or so tables tiny in comparison
January 11, 2008 at 7:47 pm
You should probably check which columns are in the index vs what you update in the tables... if you're modifying those columns, that'll certainly cause the index to jump about. Also, you should probably ensure that you have an effective clustered index that prevents data from being inserted in the middle of the table on large tables.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 21, 2008 at 8:44 am
i did a drop/recreate of the index and same thing. checked a few others and even after the days the index is rebuilt the level 1 of the index is still 99% fragmented.
our clustered index is an identity column and we have plans to change it to another column for faster selects on some queries so this may solve it.
January 25, 2008 at 2:44 am
Just a question to ask...you're not shrinking the data file after the index rebuild or have autoshrink on?
January 25, 2008 at 8:50 am
can you please post the output from either the index physical stats DMV or dbcc showcontig? Note that showcontig is a blocking operation.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
January 25, 2008 at 9:03 am
How many non-leaf pages are there in the index? I think one of the index DMVs will show you that
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 28, 2008 at 8:40 pm
I wouldn't be concerned about it - if your indexes are being used regularly then most likely the majority of the upper levels will be in cache anyway. Also, the circumstances where SQL Server does readahead on the level above the leaf level are pretty rare and the only thing that will benefit from removing fragmentation at that level.
Thanks
Paul Randal
CEO, SQLskills.com: Check out SQLskills online training!
Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005
January 29, 2008 at 9:30 am
Slightly off topic, but if you are planning to re-define your clustered index on one or more non-identity columns, choosing keys found in GROUP BY/ORDER BY clauses is going to give you the greatest performance benefit. Clustered indexes are most beneficial when used to return a ***range*** of records.
__________________________________________________________________________________
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
Persisting SQL Server Index-Usage Statistics with MERGE[/url]
Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]
January 30, 2008 at 8:39 am
I just now noticed that you specified UPPER levels of the indexes. Do you have the Pad Index option turned on?
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
Viewing 15 posts - 1 through 15 (of 20 total)
You must be logged in to reply to this topic. Login to reply