what is the fast way to prepare test db? slimming mysql db My idea is this:


get mysql dump file from production (GBs)
prepare set of requests based on access logs and run them
record all accessed records in mysql
remove everything else in my db
finally: have lightweight db and recorded requests as tests.


I have a problem with points 3+4. I wonder if such a feature even exists for MySQL, with the possibility to delete, and drop everything that was not accessed (including indexes rebuild).

Of course, having a lightweight DB is needed to easily auto-generate test fixtures, and this is the main purpose.
MySQL doesn't contain any built-in way of marking rows when they're accessed. You could conceivably use triggers to record updates, inserts, and deletes, but not selects.

It's conceivable that somebody could adapt the alpha-quality MySQL proxy server, or the MySQL relay, to build a recording proxy. But that would be a lot of work, and it would yield the queries.