⟩ How to compute database fragmentation in Sybase?
Command
dbcc traceon(3604)
go
dbcc tab(production, my_table, 0)
go
Interpretation
A delta of one means the next page is on the same track, two is a short seek, three is a long seek. You can play with these constants but they aren't that important.
A table I thought was unfragmented had L1 = 1.2 L2 = 1.8
A table I thought was fragmented had L1 = 2.4 L2 = 6.6
How to Fix
You fix a fragmented table with clustered index by dropping and creating the index. This measurement isn't the correct one for tables without clustered indexes. If your table doesn't have a clustered index, create a dummy one and drop it.