If you think that your wordpress pages are loading slowly, it is time to do some troubleshooting to improve the page speed. Do not wait in doing the troubleshooting and let your site’s success be its downfall. Whether you’re a developer or a website owner, you want your site to handle any type of traffic without slowing down.
WordPress use MySql database to store all the plugin options, theme options, your pages, your posts, users and comments, with more visitors your site need to be able to scale or in my case I had user spikes (increased traffic) that took out the connection to MySql, as memory on the server was used up. Scaling your site by replicating your MySql database is a good start. MySql replication is a process that allows you to easily maintain multiple copies of a MySQL data by having them copied automatically from a master to a slave database.
How to merge two MySql tables that have the same structure and were the primary keys of the two tables will clash.
One option is:
INSERT IGNORE INTO table_1 SELECT * FROM table_2;
which allows those rows in table_1 to supersede those in table_2 that have a matching primary key, while still inserting rows with new primary keys.
REPLACE INTO table_1 SELECT * FROM table_2;
will update those rows already in table_1 with the corresponding row from table_2, while inserting rows with new primary keys.