MySQL Forums
Forum List  »  PHP

Update more than 30,000 records row by row
Posted by: Yogesh Mahadnac
Date: June 09, 2011 05:32AM


I currently have to launch an update of more than 30,000 records, row by row, on my MySQL database. I'm using PHP as the scripting language.

Actually, the person who has created the module I'm currently re-engineered has stored all the values as 1 text field (with a ¦ separator between fields). Yes, you read correctly! Everything is in 1 field, instead of date being in a datefield, time in a timefield, address in a varchar or text, numeric data in a numeric field, etc (that sucks, I know!) - and I was told that it was done by a top-class programmer! lol... top-class nut who doesn't even know the basics of proper database administration, yea! ;-)

And now, I need to split this text field into each individual (and appropriate) field and then run a script to backdate all those records, line by line (there are no distinct values unfortunately - i've tried select distinct theFieldName from myTable, and it returns 34,000 records).

I've already created the PHP script, tested with 10 records (as dummy), works like a charm!

But now, I need to find a way to update the whole bulk of data in the database.

The problem is, if I launch my PHP script on the browser, it times out after some time.

So, I need to find a way to perform such big updates effectively (maybe at database level?)

Grateful if you could please advise on the above at your earliest convenience.


Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.