Recently I was introduced to the new feature of MySQL: performance_schema, and it's awesome. Specially when it's joined with MySQL Workbench's Performance Reports
. I find the High Cost SQL Statements
section pretty useful and practical. There's only one downside to it, the SQL column which holds the executed SQL statement is truncated in long cases.
I believe it's truncated by Workbench and not the performance_schema but I've got no solid evidence to prove it. Does anyone know how to have the complete version of SQL?
You can easily change this limit by going to MySQL Workbench >> Edit >> Preferences >> SQL Queries tab. Over here you will option to Limit Rows. You can set this to very high value or uncheck the option. When you uncheck that option, it will retrieve all the rows from a query (equivalent to no limits).
View server performance statistics in a graphical dashboard. To display the dashboard, open a query tab and then click Dashboard from the Performance area of the Navigator sidebar with the Management tab selected.
To enable all available Performance Schema instruments, pause your pointer device over Fully Enabled and click the circle on the slide bar. The SYS schema is bundled with MySQL Server 5.7 and above, and MySQL Workbench uses that version.
I managed to figure it out myself.
The information presented in MySQL Workbench's Dashboard are extracted using a series of views defined within sys
database. The mentioned views are created based on the tables found in performance_schema
database. The field responsible to hold SQL statements resides in sys.x$statement_analysis
view which is taking it from performance_schema.events_statements_summary_by_digest
table in turn. Even though this field is defined as LONGTEXT
and can hold as many characters as 4G, but the SQL statements are truncated when they are inserted.
The maximum length of characters that will be inserted into DIGEST_TEXT
is controlled by max_digest_length config. Its default value is set to 1024 and it can be increased as big as 1048576. But keep in mind that this config can be set on MySQL version greater than 5.6.24 only!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With