The mysql general log outputs all statements and commands sent to the server in a plain text format. This is useful for many things such as gathering all queries that the server is running, including selects that wouldn’t otherwise show up in the binary logs. However this format isn’t always easy to parse and extract whole statements from because queries with newline characters mean that you have to read until the beginning of the next entry to find out where your statement actually ends. This perl script will take care of finding these boundaries and printing statements.
The output can then be used more easily to feed into mysqlslap and/or maatkit’s mk-query-profiler for instance. 继续阅读