In my experiment, each experiment running needs a table in the control machine to record the global inserted files in the system. When an experiment finished, a new empty table should be created in order to record the new experiment's inserted files. For later experiment process, the old table should be backed up also. There could be more efficient and reliable way to back up the tables in a MySQL database, but here is my method to accomplish this task with two SQL commands:
- Rename the old table: RENAME TABLE store_record TO <new_name>
- Create an empty table: CREATE TABLE <new_name> LIKE store_record
After these two SQL command, the original 'store_record' table becomes 'new_name' table and an empty new 'store_record' table is created.
WARNING: there is no quotation marks for table name!
This is put in the process of cleaning up experiment results. If cleaning up is necessary, then the data in 'store_record' table is useless. And it is free to be replaced by an empty one for next experiment. If the cleaning up is not performed, it means that the data in last experiment is useful in the next experiment, then the remaining of data in 'store_record' is meaningful.
No comments:
Post a Comment