Index Advice
index_adviceList indexes the query optimizer requested for a library's tables, showing key columns, advice counts, and reasons, to help you decide which indexes to create.
Instructions
List the indexes the query optimizer asked for on the tables of a library, from the IBM i index advisor (QSYS2.SYSIXADV). Rows with the same table, key columns, and index type are merged into one, with counts summed and reason codes described. Sorted by mti_used, then times_advised: advice where the optimizer kept building and reusing a maintained temporary index (MTI) is the strongest signal. key_columns are in CREATE INDEX order and can end in DESC. last_advised and since are in the system's local time. This tool only reads the advice; it does not create indexes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum rows to return. Capped by QUERY_MAX_LIMIT. | |
| since | No | Only advice last given on or after this date or timestamp, in the IBM i system's local time with no time zone. Example: "2026-01-31" or "2026-01-31 08:00:00" | |
| table | No | Table name. Omit for every table in the library. | |
| schema | No | Schema (library) whose tables to read advice for. Uses the system's default schema if not provided. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | ||
| cause | No | Why the statement failed. &1-style placeholders stand for values in error. | |
| count | No | ||
| error | No | ||
| since | No | ||
| table | No | ||
| schema | No | ||
| sqlcode | No | SQLCODE of the failed statement, such as -204 | |
| success | Yes | ||
| recovery | No | What to change before trying again | |
| sqlstate | No | SQLSTATE of the failed statement | |
| truncated | No |