--- mariadb-10.0.4-original/sql/sql_show.cc 2013-08-18 02:55:32.746601092 -0300 +++ mariadb-10.0.4/sql/sql_show.cc 2013-08-18 06:34:33.071316689 -0300 @@ -2541,10 +2541,12 @@ restore_record(table, s->default_values); /* ID */ table->field[0]->store((longlong) tmp->thread_id, TRUE); + table->field[1]->store((longlong) tmp->query_id, TRUE); + /* USER */ val= tmp_sctx->user ? tmp_sctx->user : (tmp->system_thread ? "system user" : "unauthenticated user"); - table->field[1]->store(val, strlen(val), cs); + table->field[2]->store(val, strlen(val), cs); /* HOST */ if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) && thd->security_ctx->host_or_ip[0]) @@ -2552,16 +2554,16 @@ char host[LIST_PROCESS_HOST_LEN + 1]; my_snprintf(host, LIST_PROCESS_HOST_LEN, "%s:%u", tmp_sctx->host_or_ip, tmp->peer_port); - table->field[2]->store(host, strlen(host), cs); + table->field[3]->store(host, strlen(host), cs); } else - table->field[2]->store(tmp_sctx->host_or_ip, + table->field[3]->store(tmp_sctx->host_or_ip, strlen(tmp_sctx->host_or_ip), cs); /* DB */ if (tmp->db) { - table->field[3]->store(tmp->db, strlen(tmp->db), cs); - table->field[3]->set_notnull(); + table->field[4]->store(tmp->db, strlen(tmp->db), cs); + table->field[4]->set_notnull(); } mysql_mutex_lock(&tmp->LOCK_thd_data); @@ -2570,19 +2572,19 @@ /* COMMAND */ if ((val= (char *) ((tmp->killed >= KILL_QUERY ? "Killed" : 0)))) - table->field[4]->store(val, strlen(val), cs); + table->field[5]->store(val, strlen(val), cs); else - table->field[4]->store(command_name[tmp->get_command()].str, + table->field[5]->store(command_name[tmp->get_command()].str, command_name[tmp->get_command()].length, cs); /* MYSQL_TIME */ ulonglong start_utime= tmp->start_time * HRTIME_RESOLUTION + tmp->start_time_sec_part; ulonglong utime= start_utime < unow.val ? unow.val - start_utime : 0; - table->field[5]->store(utime / HRTIME_RESOLUTION, TRUE); + table->field[6]->store(utime / HRTIME_RESOLUTION, TRUE); /* STATE */ if ((val= thread_state_info(tmp))) { - table->field[6]->store(val, strlen(val), cs); - table->field[6]->set_notnull(); + table->field[7]->store(val, strlen(val), cs); + table->field[7]->set_notnull(); } if (mysys_var) @@ -2590,17 +2592,17 @@ mysql_mutex_unlock(&tmp->LOCK_thd_data); /* TIME_MS */ - table->field[8]->store((double)(utime / (HRTIME_RESOLUTION / 1000.0))); + table->field[9]->store((double)(utime / (HRTIME_RESOLUTION / 1000.0))); /* INFO */ /* Lock THD mutex that protects its data when looking at it. */ mysql_mutex_lock(&tmp->LOCK_thd_data); if (tmp->query()) { - table->field[7]->store(tmp->query(), + table->field[8]->store(tmp->query(), MY_MIN(PROCESS_LIST_INFO_WIDTH, tmp->query_length()), cs); - table->field[7]->set_notnull(); + table->field[8]->set_notnull(); } /* @@ -2609,9 +2611,9 @@ */ if ((max_counter= tmp->progress.max_counter)) { - table->field[9]->store((longlong) tmp->progress.stage + 1, 1); - table->field[10]->store((longlong) tmp->progress.max_stage, 1); - table->field[11]->store((double) tmp->progress.counter / + table->field[10]->store((longlong) tmp->progress.stage + 1, 1); + table->field[11]->store((longlong) tmp->progress.max_stage, 1); + table->field[12]->store((double) tmp->progress.counter / (double) max_counter*100.0); } mysql_mutex_unlock(&tmp->LOCK_thd_data); @@ -2621,12 +2623,12 @@ thread in this thread. However it's better that we notice it eventually than hide it. */ - table->field[12]->store((longlong) (tmp->status_var.memory_used + + table->field[13]->store((longlong) (tmp->status_var.memory_used + sizeof(THD)), FALSE); - table->field[12]->set_notnull(); - table->field[13]->store((longlong) tmp->get_examined_row_count(), TRUE); table->field[13]->set_notnull(); + table->field[14]->store((longlong) tmp->get_examined_row_count(), TRUE); + table->field[14]->set_notnull(); if (schema_table_store_record(thd, table)) { @@ -8668,6 +8670,7 @@ ST_FIELD_INFO processlist_fields_info[]= { {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE}, + {"QUERY_ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Query_Id", SKIP_OPEN_TABLE}, {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", SKIP_OPEN_TABLE}, {"HOST", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Host",