Skip to content

Commit

Permalink
MDEV-8191 - THD::set_query() takes 0.07% in OLTP RO
Browse files Browse the repository at this point in the history
Moved THD::set_query() definition to sql_class.h so that it can be inlined.

Overhead change:
THD::set_query       0.07% -> out of radar
  • Loading branch information
svoj committed Jun 2, 2015
1 parent 3709c7f commit d298b02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
13 changes: 0 additions & 13 deletions sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5064,19 +5064,6 @@ void THD::set_command(enum enum_server_command command)
#endif
}

/** Assign a new value to thd->query. */

void THD::set_query(const CSET_STRING &string_arg)
{
mysql_mutex_lock(&LOCK_thd_data);
set_query_inner(string_arg);
mysql_mutex_unlock(&LOCK_thd_data);

#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL(set_thread_info)(query(), query_length());
#endif
}

/** Assign a new value to thd->query and thd->query_id. */

void THD::set_query_and_id(char *query_arg, uint32 query_length_arg,
Expand Down
11 changes: 10 additions & 1 deletion sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -3704,7 +3704,16 @@ class THD :public Statement,
{
set_query(CSET_STRING(query_arg, query_length_arg, charset()));
}
void set_query(const CSET_STRING &str); /* Mutex protected */
void set_query(const CSET_STRING &string_arg)
{
mysql_mutex_lock(&LOCK_thd_data);
set_query_inner(string_arg);
mysql_mutex_unlock(&LOCK_thd_data);

#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL(set_thread_info)(query(), query_length());
#endif
}
void reset_query() /* Mutex protected */
{ set_query(CSET_STRING()); }
void set_query_and_id(char *query_arg, uint32 query_length_arg,
Expand Down

0 comments on commit d298b02

Please sign in to comment.