| | |
update in steps? is it possible ?
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi ,
Wishes!
I am doing a iterative calculation and in the last iteration, i update few of my tables. What i am trying to do is , make this update more perfect.
Is it possible for me to do updates in small steps with using LIMIT. i do not find this anywhere mentioned and do not have a idea of my own. say i got 10000 records, i get this count and update in steps of 1000 each time as might be this would prevent from a update table to lock the entire table for long.
My table is innoDB type and i would appreciate some nice examples or pointers in this regard.
Harisaff
Wishes!
I am doing a iterative calculation and in the last iteration, i update few of my tables. What i am trying to do is , make this update more perfect.
Is it possible for me to do updates in small steps with using LIMIT. i do not find this anywhere mentioned and do not have a idea of my own. say i got 10000 records, i get this count and update in steps of 1000 each time as might be this would prevent from a update table to lock the entire table for long.
My table is innoDB type and i would appreciate some nice examples or pointers in this regard.
Harisaff
try this code:
php Syntax (Toggle Plain Text)
$qry=mysql_query("SELECT * FROM yourtablename "); $num=mysql_num_rows($qry); $start=0; $len=1000; $value=$_POST['field'] while($start<$num) { $f="update tablename set field='".$value."' LIMIT $start,$len"; $start=$start+1000; $len=$len+1000; }
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Hi Shanti,
Thanks for the reply but I needed an advance logic for my script was in need of an alternative with temporary tables and the total record set to play with was 64 lakh records. Also, 5 iterations, with 5 temporary table and advanced 3 line formula computation gets it all challenging.
By the way, I had figures out for iterations and is well, now needs the final write back to master more replication sync.. working on that front.
Thanks again.
Regards
Harish
Thanks for the reply but I needed an advance logic for my script was in need of an alternative with temporary tables and the total record set to play with was 64 lakh records. Also, 5 iterations, with 5 temporary table and advanced 3 line formula computation gets it all challenging.
By the way, I had figures out for iterations and is well, now needs the final write back to master more replication sync.. working on that front.
Thanks again.
Regards
Harish
•
•
•
•
try this code:
php Syntax (Toggle Plain Text)
$qry=mysql_query("SELECT * FROM yourtablename "); $num=mysql_num_rows($qry); $start=0; $len=1000; $value=$_POST['field'] while($start<$num) { $f="update tablename set field='".$value."' LIMIT $start,$len"; $start=$start+1000; $len=$len+1000; }
![]() |
Similar Threads
- windows update doesn't work (Windows NT / 2000 / XP)
- how to update an access DB with vb.net? (ASP.NET)
- msn,messanger,update,ebay loggin problems,jus blank page (Web Browsers)
- Removal of "Home Search Assistant", "Search Extender", & "Shopping Wizard" (Viruses, Spyware and other Nasties)
- Windows Update keeps downloading the same Update (Windows 95 / 98 / Me)
- xp - svchost using 100% - steps to diagnose problem? (Windows NT / 2000 / XP)
- windows update not work!! (Windows 95 / 98 / Me)
Other Threads in the MySQL Forum
- Previous Thread: Pulling related data from relational dB re: thread: Problems with a many-to-many inse
- Next Thread: How to countdown to a date in MySQL
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law license licensing linux maintenance managing mariadb metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opensource oracle php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb single sourcecode spotify sql sugarcrm syntax table techsupport thunderbird transparency






