Does MySQL use transactions for DROP DATABASE...
statement (all tables use InnoDB engine)?
Basically I would like to know if any data will be lost if I kill DROP DATABASE...
query while it's running?
I've tested this with tables and it works but I don't have big enough database to test it:
mysql> SELECT COUNT(*) FROM t1;
+----------+
| COUNT(*) |
+----------+
| 10000000 |
+----------+
1 row in set (8.57 sec)
mysql> DELETE FROM t1;
Another MySQL session:
mysql> SHOW PROCESSLIST;
+-----+------+-----------+------+---------+------+----------+-------------------+-----------+---------------+
| Id | User | Host | db | Command | Time | State | Info | Rows_sent | Rows_examined |
+-----+------+-----------+------+---------+------+----------+-------------------+-----------+---------------+
| 211 | root | localhost | test | Query | 0 | init | SHOW PROCESSLIST | 0 | 0 |
| 242 | root | localhost | test | Query | 4 | updating | DELETE FROM t1 | 0 | 879266 |
+-----+------+-----------+------+---------+------+----------+-------------------+-----------+---------------+
2 rows in set (0.00 sec)
mysql> KILL 242;
Query OK, 0 rows affected (0.00 sec)
back to first session
mysql> SELECT COUNT(*) FROM t1;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 283
Current database: test
+----------+
| COUNT(*) |
+----------+
| 10000000 |
+----------+
1 row in set (6.91 sec)