We're using MySQL and have an ~1.1 million record InnoDB table where the entire table has to be replaced with data from a CSV twice per day.
What I've been doing up until now is truncating the table, then using mysqlimport to repopulate the table from the fresh CSV twice a day. This results in around 160 seconds of downtime, which I was initially told was fine, but that is no longer the case.
The only way I can think of to do this is to have a staging table and a production table. Live queries will go to production, and when I need to repopulate the db, I'll truncate staging, then mysqlimport the CSV into it, then after that is done I will swap the names so that staging will have the old database and production will contain the freshly imported CSV. I guess I would need an intermediate name, like production becomes production2, the staging becomes production, and then production2 becomes staging.
Does anyone have an alternate solution? The table needs to be imported as quickly as possible which is why I'm using mysqlimport, and the downtime must be extremely minimal.