I am struggling to update my massive database but my wamp/Heidisql keeps crashing due to this large update/comparisons.
I have two database tables: main table "member_all" (contains 3 million records) and child table:"mobile_results" (contains 9,000 records). The database structure of tables look like this:
Main Table ("member_all")
id int(11),
name varchar(255),
phoneWork varchar(255),
phoneMobile  varchar(255),
phoneMobileNetwork varchar(255)
Data in table looks like this:
id name      phoneWork      phoneMobile   phoneMobileNetwork 
1  bill      061090999990   0789867676    Null
3  billsaasa 06109094399990 076689867676  Null
Child Table : ("mobile_results")
id int(11) autoincrement,
phoneMobile varchar(255),
phoneMobileNetwork  varchar(255)
Data in mobile_results looks like this:
id     phoneMobile  phoneMobileNetwork
8789   0789867676   Orange     
238789 076689867676 O2
All my mobile network data for 9,000 mobile number is stored in "mobile_results" but when i try to compare both these table ,i get stuck and my wamp/Heidi sql crashes?
My question is :
How can i populate "member_all" with "phoneMobileNetwork" values from "mobile_results" efficiently?
Here are the queries i have tried:
Query 1
i divided my query using limit .This is slow and would also take 1 week to compare 9,000 records from mobile_results.
update  member_all,mobile_results 
set member_all.phoneMobileNetwork=mobile_results.phoneMobileNetwork  
where member_all.phoneMobile in  
(SELECT phoneMobile FROM mobile_results limit 1,10);
Query 2
update  member_all,mobile_results 
set member_all.phoneMobileNetwork=mobile_results.phoneMobileNetwork  
where member_all.phoneMobile in  
(SELECT phoneMobile FROM mobile_results where id <10);
Same not good for large number of records.
PLEASE help me how can i update records my "member_all" table efficiently in one go.
I would appreciate you help in this regard.
 
     
     
     
    