MySQL 5.5 – view all queries executed on certain table

MySQLmysql-5.5

I need to explore queries, which were executed on certain table.

For example, in Oracle we could investigate the V$SQL_TEXT, maybe something similar exists in MySQL 5.5?

Best Answer

  • The "general log", if turned on, records all queries touching all tables.
  • The "slow log", if turned on with long_query_time=0, records all queries, plus performance-related info, for all tables.

In either case, you would need to filter down to the desired table. This cannot be done with a simple grep since the log formats involve multiple lines of text. Still, it is better than nothing.

(There is no feature of MySQL to monitor a single table or database or user. This Answer applies to all(?) versions of MySQL.)