database - MySQL Update a Complete Column data from Another Table with same Primary Key (30 Million Row) -


i have 2 tables: final , primary in mysql database. final table:

uid (primary key), surface (varchar), bcd_value (int , index), env_value (int) 

primary table:

uid (primary key), bcd_value (int , index) 

there 30 million rows in each table. primary table has correct bcd_value. have update final table's bcd_value values primary on matching uid.

i using following in mysql command line

update primary pri, final fin set fn.bcd_value = pri.bcd_value fin.uid = pri.uid 

but nothing after 36 hours.

further, have implement update code in perl creates update statement 5000 rows @ time (loops 30 million/ 5000 times). working desperately need fasten it.

try converting ansi sql-92 syntax

update final fin inner join `primary` pri        on fin.uid = pri.uid set fn.bcd_value = pri.bcd_value 

it takes time update records because updates indexes well.

try removing index on final.bcd_value first add again after update has been made.


Comments