Home > Software engineering >  MySql 5.5; possible to exclude a table from logging?
MySql 5.5; possible to exclude a table from logging?

Time:03-30

MySql 5.5 has a few logging option, among which the "Binary Logfile" with Binlog options which I do not want to use and the "query log file" which I want to use.

However, 1 program using 1 table in that database is filling this logfile with 50 Mb per day, so I would like that table to be excluded from this log.

Is that possible, or is the only way to install another MySql version and then to move this 1 table?

Thanks, Alex

CodePudding user response:

There are options for filtering the binlog by table, but not the query logs.

There are no options for filtering the general query log. It is either enabled for all queries, or else it's disabled.

There are options for filtering the slow query log, but not by table. For example, to log only queries that take longer than N seconds, or queries that don't use an index. Percona Server adds some options to filter the slow query log based on sampling.

You can use a session variable to disable either slow query or general query logging for queries run in a given session. This is a dynamic setting, so you can change it at will. But you would need to change your client code to do this every time you query that specific table.

Another option is to implement log rotation for the slow query log, so it never grows too large. See https://www.percona.com/blog/2013/04/18/rotating-mysql-slow-logs-safely/

  • Related