c++ - Creating temporary table while still accessing other tables -
i've got 2 or more databases attached 1 sqlite database connection. each database consists of 3 tables. have better access searching/filtering, create huge temporary table on tables , databases this:
"create temporary table temp_table " "select * pb.name_table " "left join pb.phone_table on (pb.name_table.id=pb.phone_table.id) " \ "left join pb.email_table on (pb.name_table.id=pb.email_table.id) " \ "union select * name_table " \<br> "left join phone_table on (name_table.id=phone_table.id) " \ "left join email_table on (name_table.id=email_table.id);";
if changes in table, have recreate temporary table.
increasing amount of data, creating temporary table takes time, since i'm having continuous read access table, idea follows:
- create thread, creates second temp table in background
- block access reading clients
- drop first temp table
- rename second temp table
the problem now: creating temporary table write access database, blocks automatically reading threads also.
has idea how can handle this? need read access while recreating temporary table.
as long threads part of same program, have control on database connections. can write data in separate database, , attach later.
Comments
Post a Comment