Bug #71001 Please add a SQL_TRUNCATED column to P_S tables which show SQL_TEXT
Submitted: 25 Nov 2013 13:24 Modified: 25 Nov 2013 13:33
Reporter: Simon Mudd (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S4 (Feature request)
Version:5.6.14 but 5.7 too OS:Any
Assigned to: Marc ALFF CPU Architecture:Any
Tags: performance_schema, sql_text, sql_truncated

[25 Nov 2013 13:24] Simon Mudd
Description:
Anyone that is looking at the new performance_schema tables will really like the event_statements_* tables as this provides information including the SQL_TEXT that's provided in some of the queries.

This information is really good.

mysqld permits queries to be as large as max_allowed_packet and that value can be quite big. On servers I manage this value is generally 16M, so considerably larger than the maximum size that you can store in the SQL_TEXT column. Given this, large queries WILL get truncated, but there is no way to know this short of trying to execute the given query or an EXPLAIN on a given query, both of which will give a error as the SQL text is not executable.

How to repeat:
see above.

Suggested fix:
In order to prevent people trying to see if the text is complete and guessing when the length is the current maximum length please provide an additional column SQL_TRUNCATED which indicates that the SQL_TEXT is incomplete and therefore trying to parse the SQL may fail.

This will save time, remove useless errors and for applications like MySQL Enterprise Monitor or other applications which try to look at the data in P_S.events_statements_* which try to analyze this data systematically.