1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Slow query log to file now displays queries with microsecond precission

--long-query-time is now given in seconds with microseconds as decimals
--min_examined_row_limit added for slow query log
long_query_time user variable is now double with 6 decimals
Added functions to get time in microseconds
Added faster time() functions for system that has gethrtime()  (Solaris)
We now do less time() calls.
Added field->in_read_set() and field->in_write_set() for easier field manipulation by handlers
set_var.cc and my_getopt() can now handle DOUBLE variables.
All time() calls changed to my_time()
my_time() now does retry's if time() call fails.
Added debug function for stopping in mysql_admin_table() when tables are locked
Some trivial function and struct variable renames to avoid merge errors.
Fixed compiler warnings
Initialization of some time variables on windows moved to my_init()
This commit is contained in:
monty@mysql.com/nosik.monty.fi
2007-07-30 11:33:50 +03:00
parent a33c863ffd
commit b16289a5e0
56 changed files with 625 additions and 245 deletions

View File

@ -1297,7 +1297,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
void log_slow_statement(THD *thd)
{
time_t start_of_query;
DBUG_ENTER("log_slow_statement");
/*
@ -1308,25 +1307,24 @@ void log_slow_statement(THD *thd)
if (unlikely(thd->in_sub_stmt))
DBUG_VOID_RETURN; // Don't set time for sub stmt
start_of_query= thd->start_time;
thd->end_time(); // Set start time
/*
Do not log administrative statements unless the appropriate option is
set; do not log into slow log if reading from backup.
*/
if (thd->enable_slow_log && !thd->user_time)
{
thd->proc_info="logging slow query";
ulonglong end_utime_of_query= thd->current_utime();
if ((ulong) (thd->start_time - thd->time_after_lock) >
thd->variables.long_query_time ||
((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
opt_log_queries_not_using_indexes))
thd->proc_info="logging slow query";
if (((end_utime_of_query - thd->utime_after_lock) >
thd->variables.long_query_time ||
((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
opt_log_queries_not_using_indexes)) &&
thd->examined_row_count >= thd->variables.min_examined_row_limit)
{
thd->status_var.long_query_count++;
slow_log_print(thd, thd->query, thd->query_length, start_of_query);
slow_log_print(thd, thd->query, thd->query_length, end_utime_of_query);
}
}
DBUG_VOID_RETURN;