I have php-script, which every 30 sec post the
to the MYSQL-table A (about 100K columns). The table A looks as follows (sql_id is the AUTO_INCREMENT column number):
Also, I have the table B (about 100K columns), which consist of the same data as A , but for the previous period (before the 2016-01-27). So, A starts exactly from the moment, then B was finishing.
Finally I need to have one table, with joined data and:
What will be the best way to do that during 30 sec (before script post the next data)?
The solution is. It could be done, all via sql commands. So its very fast. Every step could be executed independently. But if you have a live system with traffic STEP 4 and STEP 5 should be executed in a transaction.
Insert the data of B in C but with primary_key = NULL for auto_inc
INSERT INTO C (sql_id,date_time,cian) SELECT NULL, date_time, cian FROM B;
Insert the data of A in C but with primary_key = NULL for auto_inc
INSERT INTO C (sql_id,date_time,cian) SELECT NULL, date_time, cian FROM A;
Delete Table A
DROP TABLE A;
Rename the Table C to A
ALTER TABLE C RENAME TO A;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.