|Think about Loose Coupling|
Re: DBI: How to update 150K records efficientlyby herveus (Parson)
|on Mar 31, 2008 at 14:22 UTC||Need Help??|
Doing transactions that contain multiple updates will buy you some, in my experience. You should do some testing to find out how much benefit you get from various batch sizes.
I'm not immediately able to sort out if that call to update uses a prepared and cached statement. A prepared statement with placeholders will probably be faster than preparing the statement each time.
Are you always updating the one table, or is the code simply an example?
Assuming it's not just illustrative, I'd do:
Now you can experiment with different batch sizes to see how it speeds up.