当前位置: 动力学知识库 > 问答 > 编程问答 >

mysql update a table from another table performance

问题描述:

I have two mysql tables,

table_A = 2500000+ (rows)

table_B = 6000000+ (rows)

I need to update rows in table_A from data in table_B (using a multithreaded application)

What is the fastest way

Option A

update table_b b (select col_a,col_b from table_a where col_c=%s) b set a.col_a=b.col_a, a.col_b=b.col_b flag='C' where col_c=%s

Option B

data=select col_a,col_bfrom table_a where col_c=%s

update table_b set col_a=%s,col_b=%s,flag='C' where col_c=%s

Option C

left join table_b with table_a

分享给朋友:
您可能感兴趣的文章:
随机阅读: