Opened 19 years ago
Closed 19 years ago
#4589 closed defect (bug) (fixed)
Export post query memory usage
| Reported by: | tellyworth | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.3 |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
(In [5785]) Reduce export mem usage. Props tellyworth. fixes #4589