Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - SQL 的用法 » 监控和提高数据库性能 » 应用程序分析教程 » 教程:诊断索引碎片

 

第 3 课:检查表的索引密度

要定期检查一个表的索引密度,请运行 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;
另请参见