mennanov
mennanov

Reputation: 1245

MySQL profiler cuts queries more that 300 characters length

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!

Upvotes: 4

Views: 709

Answers (1)

Marc Alff
Marc Alff

Reputation: 8395

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.

Upvotes: 5

Related Questions