=== Beyond Wpdb === Contributors: pressmaninc,kazunao,hiroshisekiguchi,hommakoharu,pmhirotaka Tags: pressman,pressmaninc,json,meta_query,wpdb,database,fast,speed,speed up,sql,replace sql Stable tag: 1.1.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Requires Wordpress: 5.4 Requires PHP: 7.0 Requires MySQL: 5.7 Requires MariaDB: 10.2 Tested up to: 5.4 Are you having trouble with slow queries due to WordPress table structure? This plugin helps your site speed up using JSON type columns, one of the features of MySQL, and prevents complex queries while maintaining the flexibility of WordPress development. You can also add a virtual column in the configuration page and index the virtual column to make it even faster.You can also add a virtual column in the configuration page and index the virtual column to make it even faster. == Features == If a large amount of meta data is given to 1 post/user/comment and a complex meta_query is specified, a large number of inner joins will occur, which will slow down the execution of the query. The effect will be noticeable especially when the number of records is large. This plugin avoids complex joins and prevents slowdowns by storing all the meta data for 1 post/user/comment in a JSON type column in a custom meta table. The dedicated configuration page includes a check for group_concat_max_len, a function to measure consistency of meta table and its custom meta table, and the ability to add virtual columns, add a The ability to create indexes. Indexes on virtual columns to make it even faster. == Actual Behavior == * Converts the SQL that WordPress auto-generates when using the default APIs of get_posts, Wp_Query, and etc. into a simple SQL that combines the posts/users/comment table with its own meta table. * The custom meta table automatically stores data using MySQL and MariaDB triggers. == Conversion Conditions == * Both the value in meta_key and meta_value is specified. * If meta_compare_key is specified, only `=` or `EXISTS` are allowed. * `suppress_filters` is false. == Custom meta tables generated by plugin == * postmeta_json (for posts table) * usermeta_json (for users table) * commentmeta_json (for comment table) == Columns in each table == * postmeta_json * post_id(int) * json(json) * usermeta_json * post_id(int) * json(json) * commentmeta_json * post_id(int) * json(json) == Example of storing data in JSON type column ==
{ "state": "Wisconsin", "city": "Winter" } 
== Results of Speed Measurement == ex1 ) Create 100 posts and 50 meta data for each post. Combine them 9 times. * postmeta_json * Equal:0.04 * IN:0.09 * NOT IN:0.06 * LIKE:0.03 * NOT LIKE:0.03 * BETWEEN:0.04 * NOT BETWEEN:0.04 * postmeta * Equal:4.72 * IN:4.79 * NOT IN:4.74 * LIKE:0.64 * NOT LIKE:0.66 * BETWEEN:0.63 * NOT BETWEEN:0.63 ex1 ) 10000 posts, 1 meta(category) per post.If you add a virtual column and put an index in Category, or if you add a virtual column and put an index in Category * postmeta_json(without virtual column) *Equal:0.15 *IN:1.92 *BETWEEN:0.37 *NOT BETWEEN:0.29 * postmeta_json(with virtual column) *Equal:0.02 *IN:0.35 *BETWEEN:0.12 *NOT BETWEEN:0.09 == Installation == 1.Download the plugin 2.Upload the plugin to the plugin directory 3.Enable plugins from the admin page's Plugins == Notes == * You'll need TRIGGER, SELECT, and UPDATE permissions for the target table and its columns to use the trigger feature of MySQL and MariaDB. * It makes changes to SQL only if `suppress_filters` is false.