Info
- 5 posts
- 4 voices
- Started 2 years ago by _ck_
- Latest reply from _ck_
- This topic is not a support question
here's how to fix some of the 1.0 query performance regression
-
- Posted 2 years ago #
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.phpin yourmy-plugins/directoryI 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' ); } ?> -
- Posted 2 years ago #
This drastically reduces page-gerenation and database querries!
GREAT!
-
- Posted 2 years ago #
Instantly knocked 3 queries from my mainpage, thanks :)
-
- Posted 1 year ago #
Marvellous!
-
- Posted 12 months ago #
I am bumping this as it's become more important since so many people have upgraded to 1.x and the problem still exists (and gets magnified with every extra plugin you install).
-
You must log in to post.