How can I be sure that a query was not executed?
For example, I try to execute
update `table` set `a`='b'
and got the error 2006 server has gone away
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityDon't run the SQL statement :-)
If you want the mysql client to stop you running it, there is a --safe-updates
aka --i-am-a-dummy
option.
If you want the server to rollback, use innodb tables that provide transactional support.
For the error see gone away.
How can I be sure that a query was not executed?
It did execute and it broke your database in doing so!
As such, when you next start your database, it will perform an "Instance Recovery" and undo any changes that were not committed at the point the instance died.
Once that is complete then it will be as if the query never ran - the database will have "undone" everything that the query did (to it!).
a
), COUNT(*) FROMtable
; to determine current DISTINCT number of values in your a column and total row count