HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Can't get any fragmentation of index for testing in SQL Server database

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canfragmentationsqlanydatabasegettestingforserverindex

Problem

I am filling my table in my SQL Server database with some data and I have partitions. I have one clustered index in the table. The problem I am facing is that I am not getting any fragmentation which I need in order to test. After reading some articles, I came to conclusion that I need to use file groups, but I am not sure how to achieve that.

Solution

If you're trying to artificially induce fragmentation, insert the data "backwards". That is, if your clustering key is an integer column ascending, load the data in descending order by that same integer column. You should get page splits aplenty.

Context

StackExchange Database Administrators Q#124622, answer score: 4

Revisions (0)

No revisions yet.