insert into test.qvalues
select * from qcvalues.qvalues;
i would like to knwo if the above line locks the database QCVALUES
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To me, the documentation is a little unclear:
Internal Locking Methods suggests that, in some circumstances, it is possible to insert into a MyISAM table while another session is reading from it:
However, Table Locking Issues shows a situation where the table will be locked until the SELECT is complete (this fits with your situation):
InnoDB table implement row-level locks, so only the row being read will be locked, rather than the whole table.
Rather than relying just on the documentation, I tried a little test:
table_aandtable_b.table_awith 500,000 rows.table_atotable_busing anINSERT INTO ... SELECTstatement.table_a.table_bcontains the new record.When both tables where MyISAM,
table_bdid not contain the new record after the copy. When both tables where InnoDB,table_bdid contain the new record after the copy. I have repeated this three times, and, as expected, the result was the same each time.So, in short, if your table is MyISAM, it will be locked. If it’s InnoDB, it won’t. Of course, this test does not consider updates, but I expect the results will be similar.