there is no way to store "user" and "host" on query_history_table

Bug #1546486 reported by Miguel Angel Nieto
6
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
Revision history for this message
Sveta Smirnova (svetasmirnova) wrote :

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 ***************************
sample: show tables
User_min: foo
User_max: foo
Host_min: localhost
Host_max: localhost
*************************** 2. row ***************************
sample: select user, host from mysql.user
User_min: foo
User_max: foo
Host_min: localhost
Host_max: localhost
*************************** 3. row ***************************
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.

Changed in percona-toolkit:
status: New → Confirmed
tags: added: documentation
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1328

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.