Copy MySQL table using backup -


I want to copy the content on the same table to another table on the same table. I do not want to change the name of the original or remove it.

One option is to create a new table like an existing table and then INSERT ... SELECT.

However, I think it can be the fastest to make a backup of my table mysqlhotcopy and then load it into another table. I'm not sure how I completed the second part of this - Shipment from a backup to an arbitrary table Foo.

This is an overview:

Your answer really depends on how large your desk is and how much you can stand while reading-lock time can be copied into a lot of 2 seconds.

There is no way in which you cut it, you need to have some reading locks on the table, while reading it (to be constantly read in any way). InnoDB transactions can provide a way to get snapshots continuously without holding other authors. MyISAM or InnoDB will have very different backup strategies.

with MyISAM

There is a very quick way of doing what you are saying:

  create table x_backup Like x; Optional table x_backup disabled key; Include X_backup SELECT * to x; Enable optional table x_backup keys;  

A real example:

8.68 seconds for records with size exactly 333, 935.

Name: sds_profile Engine: MySasy Version: 10 Row-Format: Dynamic Rows: 333935 Avg_row_length: 12 9 Data_Labby: 43114720 Index_Label: 11572224 MyScall> Make the table like sds_profile; The query is ok, affected by 0 rows (0.01 seconds) mysql & gt; Table x disabled key; The query is ok, affecting 0 rows (0.00 seconds) mysql & gt; Select from * sds_profile * in X *; The query is ok, affected by 333935 rows (8.68 seconds) Records: 333935 Duplicate: 0 Alerts: 0 mysql & gt; Enable table x key; The query is OK, affected by 0 rows (0.78 seconds)

with Inodbie

Consider doing this, but the correct isolation level In dealing with

Hotkey

If you are doing this with PHP, it would be nice to do this via the normal MySQL authentication mechanism. Otherwise, you need to get direct access to data dias, as well as be read private on MySQL files. Further security problems can open, with whom you do not want to fight.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -