Simulate mysql queries Simulate mysql queries mysql mysql

Simulate mysql queries


You could start a transaction before running your queries and then rollback after running them. Note that to do this you'll require InnoDB or XtraDb tables (won't work on MyISAM).

To start a transaction send to MySQL the following statement:

START TRANSACTION;

And at the end of your queries run the following statement:

ROLLBACK;

Your database will never be modified from the point of view of other connections. Your current connection will see the changes until ROLLBACK, and after that the original state will be restored.


If you just want to see how many rows would be deleted why not substitute 'delete' with 'select count(*)'?


Copy your database to a test-database or auto-generate a import-script. Than you can test whatever you want on the test-database and restore it again using the script or import.