Skip to:
Content
Pages
Categories
Search
Top
Bottom

here's how to fix some of the 1.0 query performance regression


  • _ck_
    Participant

    @_ck_

    I just realized today if you are using a bunch of plugins that have their options stored in the bbpress meta, your query count has jumped on every page in bbPress 1.0.x

    Apparently 1.0 now has a reserved list of option names that are pre-loaded, instead of *all* of them like 0.9 could. Plugins have to add their desired names to the pre-caching option, which of course 100% of all pre-exisiting plugings are not aware of, so they all cause an extra query in 1.0

    This isn’t a magic bullet by any means but you can at least fix this behavior. There isn’t any flag you can turn on to cache all (that would be far too easy) but you can fool the routine by loading all the options before it gets around to it.

    Simply make the below into a mini-plugin, or right click here

    and save as _load-options.php in your my-plugins/ directory

    I strongly suggest you save it with a leading underscore so it auto-loads.

    <?php
    /*
    Plugin Name: Load Options
    */

    global $bbdb;
    $results = $bbdb->get_results( "SELECT meta_key, meta_value FROM $bbdb->meta WHERE object_type = 'bb_option' ");
    foreach ( $results as $options ) {
    wp_cache_delete( $options->meta_key, 'bb_option_not_set' );
    wp_cache_set( $options->meta_key, maybe_unserialize( $options->meta_value ), 'bb_option' );
    }
    ?>

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.