根据用户定义的查询条件,获取索引性能的统计信息,并提供缺失索引及索引创建建议。用户可以根据这些信息查找与索引相关的性能瓶颈,并进行优化。
仅支持SQL Server
GET
名称 | 类型 | 是否必需 | 默认值 | 描述 |
---|---|---|---|---|
regionId | String | True | 地域代码,取值范围参见《各地域及可用区对照表》 | |
instanceId | String | True | RDS 实例ID,唯一标识一个RDS实例 |
名称 | 类型 | 是否必需 | 默认值 | 描述 |
---|---|---|---|---|
queryType | String | True | 查询类型,不同的查询类型按照相应的字段从高到低返回结果。 支持如下类型: Missing:缺失索引 Size:索引大小,单位KB Updates:索引更新次数 Scans:表扫描次数 Used:最少使用 | |
db | String | False | 需要查询的数据库名,多个数据库名之间用英文逗号分隔,默认所有数据库 | |
pageNumber | Integer | False | 显示数据的页码,默认为1,取值范围:[-1,1000)。pageNumber为-1时,返回所有数据页码;超过总页数时,显示最后一页。 | |
pageSize | Integer | False | 每页显示的数据条数,默认为50,取值范围:[1,100],只能为10的倍数,用于查询列表的接口 |
名称 | 类型 | 描述 |
---|---|---|
result | Result |
名称 | 类型 | 描述 |
---|---|---|
missingIndexResult | MissingIndexResult[ ] | 当queryType为Missing时,返回结果集为MissingIndexResult 当queryType为其他值时,该字段为空 |
indexPerformanceResult | IndexPerformanceResult[ ] | 当queryType为Missing时,该字段为空 当queryType为其他值时,返回IndexPerformanceResult |
totalCount | Integer | 总记录条数 |
pageNumber | Integer | 当前数据的页码 |
pageSize | Integer | 每页显示的数据条数 |
名称 | 类型 | 描述 |
---|---|---|
db | String | 数据库名 |
table | String | 表名 |
index | String | 索引名 |
sizeKB | Integer | 索引大小,单位KB |
userSeeks | Integer | 服务器启动以来,累计索引搜索次数 |
userScans | Integer | 服务器启动以来,累计表扫描次数 |
userUpdates | Integer | 服务器启动以来,累计索引更新次数 |
lastUserSeek | String | 最近索引搜索时间,格式为YYYY-MM-DD hh:mm:ss |
lastUserScan | String | 最近表扫描时间,格式为YYYY-MM-DD hh:mm:ss |
lastUserUpdate | String | 最近索引更新时间,格式为YYYY-MM-DD hh:mm:ss |
名称 | 类型 | 描述 |
---|---|---|
db | String | 数据库名 |
table | String | 表名 |
equalityColumns | String | 构成相等谓词的列的逗号分隔列表,谓词的形式如下: table.column =constant_value |
inequalityColumns | String | 用于查询的涵盖列的逗号分隔列表,即创建索引的SQL语句中,Include后的字段 |
includedColumns | String | 构成不等谓词的列的逗号分隔列表,例如以下形式的谓词: table.column > constant_value "="之外的任何比较运算符都表示不相等。 |
avgUserImpact | Float | 实现此缺失索引后,用户查询可能获得的平均百分比收益。 该值表示如果实现此缺失索引,则查询成本将按此百分比平均下降。 |
userScans | Integer | 由可能使用了组中建议索引的用户查询所导致的扫描次数。 |
userSeeks | Integer | 由可能使用了组中建议索引的用户查询所导致的搜索次数。 |
返回码 | 描述 |
---|---|
200 | OK |
GET
复制成功
public void testDescribeIndexPerformance() {
DescribeIndexPerformanceRequest request = new DescribeIndexPerformanceRequest();
request.setRegionId("cn-north-1");
request.setInstanceId("sqlserver-83uqv7avy4");
request.setQueryType("Missing");
DescribeIndexPerformanceResponse response = rdsClient.describeIndexPerformance(request);
System.out.println(new Gson().toJson(response));
}
复制成功
{
"requestId": "bpaoheg0ecbvgnj8verfr6e9awnfvicu",
"result": {
"indexPerformanceResult": [ ],
"missingIndexResult": [ ],
"pageNumber": 1,
"pageSize": 10,
"totalCount": 0
}
}
我们的产品专家为您找到最合适的产品/解决⽅案
1v1线上咨询获取售前专业咨询
专业产品顾问,随时随地沟通