> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/system-tables/sys-schema/sys-schema-stored-procedures/statement_performance_analyzer.md).

# statement\_performance\_analyzer

## Syntax

```
statement_performance_analyzer(in_action,in_table, in_views)

# in_action ENUM('snapshot', 'overall', 'delta', 'create_tmp', 
                 'create_table', 'save', 'cleanup')
# in_table VARCHAR(129)
# in_views SET ('with_runtimes_in_95th_percentile', 'analysis', 
                'with_errors_or_warnings', 'with_full_table_scans', 
                'with_sorting', 'with_temp_tables', 'custom')
```

## Description

`statement_performance_analyzer` is a [stored procedure](/docs/server/server-usage/stored-routines/stored-procedures.md) available with the [Sys Schema](/docs/server/reference/system-tables/sys-schema.md) which returns a report on running statements.

The following options from the [sys\_config](/docs/server/reference/system-tables/sys-schema/sys-schema-sys_config-table.md) table impact the output:

* statement\_performance\_analyzer.limit - maximum number of rows (default `100`) returned for views that have no built-in limit.
* statement\_performance\_analyzer.view - custom query/view to be used (default `NULL`). If the statement\_performance\_analyzer.limit configuration option is greater than 0, there can't be a `LIMIT` clause in the query/view definition.

If the debug option is set (default `OFF`), the procedure will also produce debugging output.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mariadb.com/docs/server/reference/system-tables/sys-schema/sys-schema-stored-procedures/statement_performance_analyzer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
