[wp-trac] [WordPress Trac] #4589: Export post query memory usage

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 6 03:10:19 GMT 2007

#4589: Export post query memory usage
 Reporter:  tellyworth      |       Owner:  anonymous
     Type:  defect          |      Status:  new      
 Priority:  normal          |   Milestone:           
Component:  Administration  |     Version:           
 Severity:  normal          |    Keywords:           
 The export function uses a get_results() call that loads the entire posts
 table into memory.  The result is stored in $wpdb->last_result and a
 second copy is returned by the get_results() function, so memory usage is
 at least double the table size.

 The enclosed patch alters the export post loop to fetch 20 posts from the
 table at a time.

 FYI, I considered using an offset/limit increment loop, but that could
 cause sync problems if a new post is added during the export loop.  The
 $post_ids method used here is a little ugly but works fine.  An ideal
 solution might be to provide an alternate get_results() db query mode that
 doesn't return the entire resultset as an array.

Ticket URL: <http://trac.wordpress.org/ticket/4589>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list