[wp-hackers] Best functions in WP for bulk MySQL processing?
Harish Narayanan
harish.mlists at gmail.com
Sun Mar 14 07:16:33 UTC 2010
On 3/14/10 5:33 AM, Mike Schinkel wrote:
> Hey all,
>
> I'm writing a tool to help automatically move from one domain to another. To do this I need to process through all post_content and post_excerpt fields and change any image locations that reference the old domain with the new domain (there are other things I need to do but I'm taking baby steps first.)
>
> As far as I can tell WordPress' database functions like $wpdb->query() load all posts into memory which won't work for a really large database; it would exhaust memory. While I can easily write SQL code using the mysql_* functions I'd prefer to do it using WordPress functions. Are there functions available to use for bulk processing, one I've just not found yet?
It might be more robust (and I imagine quicker) to dump the database to
file, perform whatever transformations you need using standard command
line utilities like sed, and then reinsert the modified data to your new
database server.
Harish
More information about the wp-hackers
mailing list