format_statement


Description

Description

Formats a normalized statement, truncating it if it is > 64 characters long by default.

To configure the length to truncate the statement to by default, update the statement_truncate_len variable with sys_config table to a different value. Alternatively, to change it just for just your particular session, use SET @sys.statement_truncate_len := <some new value>.

Useful for printing statement related data from Performance Schema from the command line.

Parameters

statement (LONGTEXT): The statement to format.

Returns

LONGTEXT

Example

mysql> SELECT sys.format_statement(digest_text) -> FROM performance_schema.events_statements_summary_by_digest -> ORDER by sum_timer_wait DESC limit 5; +——————————————————————-+ | sys.format_statement(digest_text) | +——————————————————————-+ | CREATE SQL SECURITY INVOKER VI … KE ? AND variable_value > ? | | CREATE SQL SECURITY INVOKER VI … aitIS NOT NULL ,esc. ... | | CREATE SQL SECURITY INVOKER VI ... ait IS NOT NULL , sys . … | | CREATE SQL SECURITY INVOKER VI … , compressed_size ) ) DESC | | CREATE SQL SECURITY INVOKER VI … LIKE ? ORDER BY timer_start | +——————————————————————-+ 5 rows in set (0.00 sec)

Parameters

Name Type Mode
statement longtext IN

Definition