[wp-trac] [WordPress Trac] #19225: WordPress-Importer : Perform less database queries when backfilling attachment urls
WordPress Trac
wp-trac at lists.automattic.com
Fri Nov 11 08:20:12 UTC 2011
#19225: WordPress-Importer : Perform less database queries when backfilling
attachment urls
-------------------------------------+----------------------------
Reporter: tott | Owner: duck_
Type: enhancement | Status: assigned
Priority: normal | Milestone: WordPress.org
Component: Import | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+----------------------------
Comment (by tott):
3 time's a charm - Note to self: don't code when ill and in a hurry to go
to bed.
I implemented the suggestions. Let me explain a bit more about the
background of this and why this is sub-optimal.
When you run a replicated MySQL setup with for example a Master and a
Slave server you need to transfer each changes from the Master to the
Slave after a change happened. Now imagine a replace query that would
change something in the post content for each url.
With each replaced url this would need to find all the matching posts,
read them, change them and write them back to the disk. So not only that
you would have something that could rewrite the content of multiple posts
at the same time you also have a scenario where you could write the same
post a couple of times depending on how many urls are in it.
That's why I changed this to a per-post approach. First figure out which
urls are in the post and then just update the post once. In this way the
worst thing that can happen is that you send one update for each post.
This should have a much lower disk IO impact than the original approach.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19225#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list