an
groups-icon

Slow SQL Fix

Wait a minute... This content is very very old. We no longer sell or support this theme version. New Topics
  • Version 9
    Richard Hawk
    0 points
    Beginner

    Hey Guys,

    I have around 12,000 listings in my directory and it was taking around 30 seconds to load the search results page or any category or taxonomy.

    The custom field list function was the culprit and my database just couldn’t handle the load.

    I modified class_core. php and replaced:

    $last_posts = (array)$wpdb->get_results($SQL);

    with

    If ( false === ( $last_posts = get_transient( ‘wlt_customfieldlist’))) {
    $last_posts = (array)$wpdb->get_results($SQL);
    set_transient( ‘wlt_customfieldlist’, $last_posts, 12 * HOUR_IN_SECONDS );
    }

    This drastically reduced the load time down to less than a second.

    This does require you to change the core file and it would be lost on update, Also, if you are actively adding custom fields this would likely not be a good solution.

    Please feel free to let me know if this might cause other problems and use it at your own risk.

    August 5, 2015 at 9:03 pm
  • Binesh Mathew P
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    August 5, 2015 at 10:03 pm
  • Richard Hawk
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    August 5, 2015 at 11:47 pm
  • Jay singh
    5 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    August 17, 2015 at 4:56 pm
  • Clive Boosey
    -1 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    August 17, 2015 at 10:24 pm
  • Richard Hawk
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    August 18, 2015 at 12:23 am
  • Jay singh
    5 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    October 14, 2015 at 1:00 am
  • Peter Glas
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    January 3, 2016 at 11:20 am

264

Views

7

Replies