2

I wonder if it is a good idea to use phpMyAdmin's empty feature on a table with ~12gb on a production server. I don't want to cause too much lag but need to free some disk space.

This needs to be done on a Debian powered DELL Server:

MySQL 5.1.49 Intel Xeon X3430 @ 2.40Ghz 4GB Memory

Assuming that phpMyAdmin uses TRUNCATE to empty the table. Can I expect several minutes or even hours to truncate the table or is it a rather quick process similar dropping a table?

  • 1
    I now did it by copying only the table structure of `table` to `table_bak`, dropping the `table` which took just some seconds and renaming the `table_bak` to `table` again. – bobble bubble Aug 23 '18 at 14:10
  • 1
    See also: https://dba.stackexchange.com/questions/212440/can-a-truncate-or-drop-table-ever-be-very-time-consuming – anx Aug 23 '18 at 14:59

1 Answers1

3

If there are zero transactions locking the table schema, the TRUNCATE TABLE command will finish near-instantaneously. The most i have waited so far was 0.1 seconds for truncating a 25GB table.

In any case, a TRUNCATE TABLE command does not have undesirable side-effects on anything but other maintenance operations. If the server is unable to acquire the necessary exclusive locks, it will block - but not because it requires a large amount of IO or processing - its merely awaiting its turn.

anx
  • 6,875
  • 4
  • 22
  • 45