English 中文(简体)
RENAME TABLE在复制的神秘结构中有什么风险?
原标题:What are the risks of RENAME TABLE inside a replicated mysql structure?

我有一份字典,为现场搜索目的优化了我的片面表的最新版本。

The table that is used in the site search is called tblSearch
the cronjob creates a new table wrkSearch and when it has finished to populate the table ends dropping tblSearch and renaming wrkSearch (both tables have MySam Engine)

DROP TABLE IF EXISTS `tblSearch
RENAME TABLE `wrkSearch` TO tblSearch

This is working fine, but I d like to know if is a good approach to the problem.
I would like to know if your considerations change based on table size... for example: "the solution could be dangerous for very big tables cause..."

我知道,我方言表内正在变化的每一个问题都是在档案系统中撰写文章......但是,在进行国家信息调查而不是UPD/INSERT之间是否存在某种差别? 我想要理解的是,RENAME的指挥系统是否多于aggresive

表格中的另一个内容是,将电信数据库复制为MASTER-SLAVE结构......因此,我也想知道这是否最终会削弱RENAME查询的风险。

对我来说很重要的另一个方面是所使用的系统资源数量......RENAME的运行是否比UPDATE/INSERT更令人满意?

问题回答

您应修改命令;首先改称:

RENAME TABLE tlbSearch TO tblSearchDropMe, wrkSearch TO tlbSearch;
DROP TABLE tblSearchDropMe;

由于RENAME是原子的,没有任何其他进程可能无法进入arch;在最初退学时,可能重新命名。

除此之外,我没有看到任何与此相关的复制问题。

更名为“自己”是快的。 如果你从桌上删除所有东西,并创造新鲜东西,那么这种方法就会被罚款。 (但请查实际复制情况)

然而,关于复制,这意味着需要传送表格的全部数据。

如果你能够的话,最好更新表格中的数据,这样就只能改变某些数据,而不是一切。

I should point out that this type of manipulation is frowned upon - with good reason! But like all rules, sometimes you have to break them.





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签