Web lists-archives.com

Re: dump then truncate - in between anything?




On 13/03/16 14:52, Richard wrote:

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
thanks, and to Johan, it's exactly what I'm trying

you might want to look at the "rename" capability. Doing something
like:
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.



may I ask, on a bit related subject - if I insert into table and there are duplicate primary keys - does mysql alert about all the duplicates or just first one and then exits/abandon the rest of the insert?
And is this a user/config controlled behavior?


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