MySQL replay tool

I was wondering if anyone knows of tool/method to replay sql statements? I understand it is possible to have all statements written to the general or slow query log and replay them. This is good if you want to replay them serially. It would be really good if they could be replaid in parallel like they were originally submitted. Thanks.

Hi @Jamie_Downs

There is a tool GitHub - Percona-Lab/query-playback: Query Playback that does something similar but it looks like it hasn’t been actively developed recently.

Pep

Thanks Pep. Do you have any experience of this tool? Does it work well with multi-statement transactions and temporary tables?

No, I never used it.

Do you think it would be possible to speak to someone at Percona about it? Who would be the best person to reach out to?

You can try the contact info here: Percona Labs | Percona Community

But I think Percona does not provide any support/maintenance for this software.

Thanks for that. I will reach out to them. I’m surprised there is not more need for tools like this as they are so valuable for perf testing, upgrades bugs etc…

@Jamie_Downs,
There is frequent request for something like this. Query playback that precisely mirrors captured traffic is incredibly, incredibly, incredibly difficult. Which is why a tool like playback has had some life, died, came back, died again. It’s also why a tool like this doesn’t exist. :slight_smile: You can look at pt-upgrade, which will replay a slow-query log in that same order. Or, the better solution is to write your own LUA script for sysbench that uses your own application queries.

Thanks I will take a look at pt-upgrade. I can understand why it is so difficult. But we can get to the moon. :slight_smile: Is it made harder because there is not quite enough info in the slow query log?
Many years ago I used a SQL Server tool called SQL Server Distributed Replay. This seemed to work. SQL Server Distributed Replay - SQL Server Distributed Replay | Microsoft Learn

There is plenty of information in the slow log to replay transactions. But doing so requires parsing the entire log, figuring out all the transactions, determining delays between transactions, order of transactions, etc. It’s hard to do. That Microsoft tool is a close-source tool, written for a close-sourced database. I’m sure they are able to add functionality to MSSQL that makes recording of the transaction data easier for replay. MySQL is 100% open source, so you are free to take a crack at it. Feel free to look at the code for Percona Playback and offer up some pull-requests.