WordPress.org

Ready to get started?Download WordPress

Forums

Quick Page/Post Redirect Plugin
This plugin is very slow (4 posts)

  1. rritoch
    Member
    Posted 5 months ago #

    Using the P3 (Plugin Performance Profiler) I was able to determine that this plugin was making a site that I am managing very slow. I reviewed the code and the only problem I could find was the database query in the get_main_array() method of the quick_page_post_reds class.

    I replaced this query with

    $theqsl = "SELECT * FROM $wpdb->postmeta a JOIN $wpdb->posts b ON a.post_id=b.ID WHERE b.post_status!='trash' AND a.meta_key IN ('_pprredirect_active','_pprredirect_rewritelink','_pprredirect_newwindow','_pprredirect_relnofollow','_pprredirect_type','_pprredirect_url') ";

    As far as I can tell there is no reason to sort these results by post so I removed the order by clause. I also reduced the string of OR conditions to an IN statement which has also been proven to be faster. I also changed the statement to use a join, this optimization is disputable but I have found 9 out of 10 times a join is faster.

    After these changes this plugin no longer shows up in the P3 profiler as a plugin using significant resources.

    Please use this optimized query for the next version of your plugin.

    http://wordpress.org/plugins/quick-pagepost-redirect-plugin/

  2. Matt
    Member
    Posted 5 months ago #

    Thanks for the suggestion rritoch. I've implemented it on a site I run, and have noticed a significant improvement as well. +1 to the plugin author including it in the next version.

  3. Paul Thomson
    Member
    Posted 4 months ago #

    +1, well spotted. Needs to be implemented in coming releases.

  4. Paul Thomson
    Member
    Posted 4 months ago #

    well spotted! Indeed your solution looks to be much faster. Needs to be implemented in coming releases. +1

Reply

You must log in to post.

About this Plugin

About this Topic