views:

16

answers:

3

If I'm using a mysql client(eg. squirrel) to execute an update query, after 10 seconds, I cancelled the query, would there be partial update or would everything that's done be rolled back?

A: 

If your query is enclosed within a Transaction block, and if you stopped it in the middle, everything would be rolled back.

Raj More
A: 

If MySql has any claims of being a real database it would roll everything back, even more so for a single update statement.

Otávio Décio
+1  A: 

You may want to review the MySQL documentation on BEGIN TRANSACTION, COMMIT, AND ROLLBACK.

I believe it is going to depend upon the engine you choose (e.g., InnoDB) and I saw the following comment about ROLLBACK:

If you issue a ROLLBACK statement after updating a nontransactional table within a transaction, an ER_WARNING_NOT_COMPLETE_ROLLBACK warning occurs. Changes to transaction-safe tables are rolled back, but not changes to nontransaction-safe tables.

itsmatt