MYSQL table crashes after x hours

Is it possible to write additional code to create a mysql table that will make it fall after X amount of time? Like a temporary table, but it will last longer.

I need to create tables for temporary tasks, but I need them to last longer than the session

+5
source share
2 answers
CREATE EVENT myevt
        ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
        DO
         DROP TABLE IF EXISTS MyTable;
+4
source

In your case with CSV files, I would advise you not to create a database table during the installation process, as this creates unnecessary stress for your DBMS. The best way to do this is:

  • Move the downloaded file to the "in" directory
  • Examine the first few bytes of the CSV to determine the number of columns and additional data that you need.
  • CSV , .

CSV , cronjob : find /dir/with/csv/files -type f -cmin +TIMEINMINUTES -delete

+1

All Articles