要定期检查一个表的索引密度,请运行 sa_index_density 系统过程。密度值范围介于 0 和 1 之间。该值越接近 1,说明索引碎片越小。该值小于 0.5 则说明索引碎片级别会影响性能。
在 Interactive SQL 中,运行以下 SQL 语句来查看本教程中引入到碎片表中的索引碎片:
CALL sa_index_density( 'fragment' ); |
TableName | TableId | IndexName | IndexId | IndexType | LeafPages | Density |
---|---|---|---|---|---|---|
fragment | 736 | idx_fragment | 1 | NUI | 1,177 | 0.597509 |
您的结果可能不同,但 [密度] 列的值应大约为 0.6。
在 Interactive SQL 中,运行以下 SQL 语句来提高索引的密度:
ALTER INDEX idx_fragment ON fragment REBUILD; |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |