Web lists-archives.com

Re: dump then truncate - in between anything?

> Date: Wednesday, March 09, 2016 14:38:45 +0000
> From: lejeczek <peljasz@xxxxxxxxxxx>
> hi everybody
> I imagine this is theoretical rather than practical question,
> albeit I don't have much practice, so I hope experts could comment
> logical view of the procedure is: mysqldump && truncate - what are
> the chances that something gets in between and I loose it?
> many thanks
> L.

If what you are trying to do is something like:

   - archive contents of live table from current period
   - empty live table
   - start collecting input again

you might want to look at the "rename" capability. Doing something
    rename <current> -> <old>
    rename <empty template> -> <current>

will be much faster than trying to dump and empty a live table. With
"rename" you'll have your data from the last period in "<old>" so can
handle it at will.

You'll want to look at what a rename vs. truncate vs. delete do to
make certain there isn't something with one of them that might cause
you a problem.

MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql