-- Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; version 2 of the License. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Formats a normalized statement, truncating it if it is > 64 characters longbydefault.
To configure the length to truncate the statement tobydefault, update the `statement_truncate_len`
variable with `sys_config` tableto a different value. Alternatively, tochange it just for just
your particular session, use `SET @sys.statement_truncate_len := <some new value>`.
Useful for printing statement related data from Performance Schemafrom
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
-> ORDERby sum_timer_wait DESClimit5;
+-------------------------------------------------------------------+
| sys.format_statement(digest_text) |
+-------------------------------------------------------------------+
| CREATESQL SECURITY INVOKER VI ... KE ? AND `variable_value` > ? |
| CREATESQL SECURITY INVOKER VI ... ait` ISNOTNULL , `esc` . ... |
| CREATESQL SECURITY INVOKER VI ... ait` ISNOTNULL , `sys` . ... |
| CREATESQL SECURITY INVOKER VI ... , `compressed_size` ) ) DESC |
| CREATESQL SECURITY INVOKER VI ... LIKE ? ORDERBY `timer_start` |
+-------------------------------------------------------------------+ 5 rows inset (0.00 sec) ' SQL SECURITY INVOKER DETERMINISTIC
NO SQL
BEGIN -- Check if we have the configured length, if not, init it IF @sys.statement_truncate_len ISNULLTHEN SET @sys.statement_truncate_len = sys_get_config('statement_truncate_len', 64);
END IF;
IF CHAR_LENGTH(statement) > @sys.statement_truncate_len THEN RETURNREPLACE(CONCAT(LEFT(statement, (@sys.statement_truncate_len/2)-2), ' ... ', RIGHT(statement, (@sys.statement_truncate_len/2)-2)), '\n', ' '); ELSE RETURNREPLACE(statement, '\n', ' ');
END IF;
END$$
DELIMITER ;
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.