i created a huge table in mysql, say
table1
i will be querying on this table for my results, continuously
once a week i will be flushing the values in table1 and insert new values.
(this process takes 3 hours of time.)
So my issue is my querying will be stopped for 3 hours(while the new table1 is being generated) , and my querying should be continuous.
i was thinking of creating a like table
create like table temp_table1 from table1
and till the time new table1 is getting populated, i will be using temp_table1 for querying. But for that i also wanted to set an automated trigger for changing between tables.
Is there any better way to achieve this?
also creating like table for a huge table would take a lot of time?
You can do it other way actually...
create table temp_table1 same as table1
Do your process in temp_table1 instead of table1
Once process completes insert the data to main table using insert into .. select from
construct
That way your main table is free for querying and won't be blocked. The final insert could be fast enough depending on the select
performance.
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.