[wp-trac] [WordPress Trac] #12257: wpdb Scales Badly Due to Unnecessary Copies of All Query Results

WordPress Trac wp-trac at lists.automattic.com
Wed Feb 17 03:08:06 UTC 2010


#12257: wpdb Scales Badly Due to Unnecessary Copies of All Query Results
--------------------------+-------------------------------------------------
 Reporter:  miqrogroove   |       Owner:  ryan        
     Type:  defect (bug)  |      Status:  new         
 Priority:  normal        |   Milestone:  3.0         
Component:  Database      |     Version:              
 Severity:  critical      |    Keywords:  dev-feedback
--------------------------+-------------------------------------------------
 While working on #11726, I encountered a reproducible crash in
 wpdb::query()

 The following code causes memory exhaustion on large result sets:

 {{{
 while ( $row = @mysql_fetch_object($this->result) ) {
         $this->last_result[$num_rows] = $row;
         $num_rows++;
 }
 }}}

 The memory exhaustion message is error-controlled, causing a white screen
 of death even in debug mode.

 I searched wp-db.php for references to $this->last_result, and I found no
 justification for these object reference copies.  $this->last_result
 '''should''' be maintained as a MySQL resource and properly optimized
 using the MySQL client layer instead of this PHP nonsense.

 Tagging for dev-feedback to discuss which Milestone is appropriate.

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


More information about the wp-trac mailing list