I faced with the same issue when I was writing my backup plugin. The bug appear when you fetch all data from db by calling $wpdb->get_results( ... )
. And as you can suppose it fetch all data into memory allocated for php. The better approach is to use mysql_*
functions to fetch row one by one and store data into temporary file. This approach will reduce memory usage tremendously.
I would recommend you to do it something like this:
$result = @mysql_query( sprintf( 'SELECT * FROM `%s`.`my_big_table`', $wpdb->dbname ), $wpdb->dbh );
if ( $result ) {
while ( ( $row = @mysql_fetch_array( $result, MYSQL_NUM ) ) ) {
// save each row to temp file
fwrite( $handle, prepare_row_to_save_into_file( $row ) );
}
@mysql_free_result( $result );
}
Related Posts:
- How do I use the WP image functions in a page template?
- Conditional tag is_page with a custom post type
- What is the criteria for pluggable functions?
- WP_Remote_Get Not working
- Twenty Eleven Child theme error when attempting to use a rewritten function
- How to overwrite / extent wordpress function is_email
- Fatal error: Cannot redeclare when switching themes
- Use register_setting() in a loop
- How to edit the Tags within the image file URLs?
- the_posts_pagination() function returns missing page numbering on some blog pages
- Filter an WordPress Function in (general-template.php)
- Why There Is No “get content by ID” Function
- Specify multiple categories for custom post template – FATAL ERROR
- Login cookies blocked after customizing hashing method
- Its my first time trying to create a website , I got an error Please help
- Warning and fatal error
- “Conditional query tags do not work before the query is run. Before > then, they always return false. “
- Fatal error: Call to undefined function. Underscore me
- How to debug function file causing white screen
- update_usermeta don’t work
- Fatal error after changes to functions.php, even with original file
- Override default password nag in WordPress
- Why functions metaboxes is causing White Screen in Admin [closed]
- is_preview() always return false
- Directing to functions.php the correct way
- How to use the do_action () with parameter
- TinyMCE custom styles remove class when switching styles
- Extending the site search to include a single custom field
- Notify users whenever a new post is published based on their preference
- Remove Header and Footer in iframe
- Formatting post content to exclude gallery
- Why do I get undefined function export_wp()?
- Redirect if not logged in?
- How to set global variables in template page?
- Setting featured image with function, 1 part not working
- Function to show only first instance of shortcode
- Comments to only be seen by their author
- Remove function or filter
- options.php problem – data not saved
- Filtering posts by category name based on page’s slug
- adding custom classes for tables
- Load parent theme files before child theme functions.php
- CSS for menu item added via functions.php
- Two functions.php files in one theme
- Default Gallery Edit/Template Editable?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Make parent page only link to first subpage
- Pulling Twitter RSS feed not working as expected (fatal error)
- How to validate this deprecated function
- How can I modify all existing tags while keeping the urls themselves?
- Scripts not appending to element in AJAX call – why?
- Trigger a custom function when option are saved in admin area
- Find a Javascript ID when trying to deregister?
- Functions.php – Cannot Modify Header Information SOLVED [closed]
- Functions For Calling Specific Elements
- How would I add “edit profile” and “blog post” functions to front-end?
- shortcode help require
- How can I add a filter for specific categories on functions.php?
- Custom editor color palette colors are not appearing in the editor
- Set Taxonomy based on post status
- echo custom fields with AJAX
- wp_create_category deprecated?
- wordpress get_post_meta give only first value
- Using multiple line variable inside a function?
- Extending a custom framework built into WordPress to automatically turn the ‘Search Engine Visibility’ setting ON / OFF, dependant on environment
- Javascript not loading after the document ready
- Need to convert image url to a Base_64 data url with wordpress function..
- Add Adsense code between job listings – wp job manager plugin
- How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]
- Modify shortcode to work with custom post types
- How to hightlight all ancestor menu items of a child page NOT displayed in menu
- Show admin page, only if function is being used
- Fatal error: allowed memory size when after using enqueue_script
- How to apply the ‘current_page_item’ class to an archive page in `wp_list_pages()`?
- functions.php pharse error on complete new install
- If has action not working as expected
- Update wp_postmeta table based on 2 keys
- Best practice to call a function from a button-link?
- Disable wordpress update notification
- How to customize archive widget only for cpt?
- some profile informations like youtube link doesnt seem
- Help using ShortCodes to style whole chunks of the post
- Extend WordPress Audio Widget to accept HLS (.m3u8) URLs
- How to modify or override a core function (wp_star_rating)
- Is there is a way to check daily first login?
- delete_user_meta for user in spesific group
- Pagination not working on my archive page for a custom post type
- Remove Featured Images from Posts Older Than a Certain Date
- Home/Static Page View for Visitors pages after that should be restricted
- functions.php filters not applied in AJAX call
- Settings in functions.php used by a plugin
- Mail function not working with user accounts
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- Conditionally write open graph meta property in header
- Adding result from PHP function into an input field
- Using array page name together with page id to deregister script
- Modifying Page-Links format
- how to handle multiple forloop?
- PHP error in shortcode [closed]
- woocommerce_sort_product_tabs() expects an array