Skip to content

Commit d298b02

Browse files
committed
MDEV-8191 - THD::set_query() takes 0.07% in OLTP RO
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
1 parent 3709c7f commit d298b02

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

sql/sql_class.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5064,19 +5064,6 @@ void THD::set_command(enum enum_server_command command)
50645064
#endif
50655065
}
50665066

5067-
/** Assign a new value to thd->query. */
5068-
5069-
void THD::set_query(const CSET_STRING &string_arg)
5070-
{
5071-
mysql_mutex_lock(&LOCK_thd_data);
5072-
set_query_inner(string_arg);
5073-
mysql_mutex_unlock(&LOCK_thd_data);
5074-
5075-
#ifdef HAVE_PSI_THREAD_INTERFACE
5076-
PSI_THREAD_CALL(set_thread_info)(query(), query_length());
5077-
#endif
5078-
}
5079-
50805067
/** Assign a new value to thd->query and thd->query_id. */
50815068

50825069
void THD::set_query_and_id(char *query_arg, uint32 query_length_arg,

sql/sql_class.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3704,7 +3704,16 @@ class THD :public Statement,
37043704
{
37053705
set_query(CSET_STRING(query_arg, query_length_arg, charset()));
37063706
}
3707-
void set_query(const CSET_STRING &str); /* Mutex protected */
3707+
void set_query(const CSET_STRING &string_arg)
3708+
{
3709+
mysql_mutex_lock(&LOCK_thd_data);
3710+
set_query_inner(string_arg);
3711+
mysql_mutex_unlock(&LOCK_thd_data);
3712+
3713+
#ifdef HAVE_PSI_THREAD_INTERFACE
3714+
PSI_THREAD_CALL(set_thread_info)(query(), query_length());
3715+
#endif
3716+
}
37083717
void reset_query() /* Mutex protected */
37093718
{ set_query(CSET_STRING()); }
37103719
void set_query_and_id(char *query_arg, uint32 query_length_arg,

0 commit comments

Comments
 (0)