Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL profiler cuts queries more that 300 characters length

Tags:

mysql

profiler

MySQL profiler cuts queries more that 300 characters length when i get the list of queries by

 SHOW PROFILES

And i see queries like this:

 SELECT media_videos.`id` AS `media_videos.id`, media_videos.`user_id` AS `media_videos.user_id`, media_videos.`description` AS `media_videos.description`, media_videos.`likes` AS `media_videos.likes`, media_videos.`video` AS `media_videos.video`, media_videos.`resource` AS `media_videos.resource`, 

(It's an automatically generated query so it can be really long)

So it shows ALL queries but big ones are cut to 300 chars and i can't see them to the end.

How can i fix that using MySQL tools only (not to profile queries in my app manually)? May be some directives in my.cnf ??

Thank you!

like image 295
mennanov Avatar asked Nov 16 '25 07:11

mennanov


1 Answers

Maybe not the answer you wanted, but the answer nonetheless:

SHOW PROFILE is implemented in sql/sql_profile.cc

Code fragments below:

#define MAX_QUERY_LENGTH 300U

used in

void QUERY_PROFILE::set_query_source(char *query_source_arg,
                                     uint query_length_arg)
{
  /* Truncate to avoid DoS attacks. */
  uint length= min(MAX_QUERY_LENGTH, query_length_arg);
  ...

So, short of recompiling the server with a bigger value, SHOW PROFILE will truncate the query to 300 characters, no matter what.

like image 119
Marc Alff Avatar answered Nov 17 '25 19:11

Marc Alff