there is no way to store "user" and "host" on query_history_table
Bug #1546486 reported by
Miguel Angel Nieto
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
pt-query-digest shows "Users" and "Hosts" fields in the query report, but there is no way to store those on query_history table using --history parameter. I have tried creating custom columns but it doesn't work.
tags: | added: i65593 |
To post a comment you must log in.
This is possible, you just need to change table definition as appropriate:
mysql> alter table query_history add column Host_min text;
Query OK, 0 rows affected (10.20 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table query_history add column Host_max text;
Query OK, 0 rows affected (8.82 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table query_history add column User_min text;
Query OK, 0 rows affected (8.82 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table query_history add column User_max text;
Query OK, 0 rows affected (8.82 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> select sample, User_min, User_max, Host_min, Host_max from query_history\G ******* ******* ****** 1. row ******* ******* ******* ****** ******* ******* ****** 2. row ******* ******* ******* ****** ******* ******* ****** 3. row ******* ******* ******* ******
*******
sample: show tables
User_min: foo
User_max: foo
Host_min: localhost
Host_max: localhost
*******
sample: select user, host from mysql.user
User_min: foo
User_max: foo
Host_min: localhost
Host_max: localhost
*******
sample: SELECT CONCAT(@@hostname, @@port)
User_min: root
User_max: root
Host_min: localhost
Host_max: localhost
...
However this is not very clear from the documentation, so will verify as documentation bug.