Results 1 to 2 of 2

Thread: Question about a query in JR

  1. #1
    Thread Starter
    southpole's Avatar
    Join Date
    Sep 2010
    Location
    Sweden
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question about a query in JR

    Hi,

    I was contacted by my web hosting provider (now former web hosting provider) a while ago and they complained about one really heavy DB query generated by JobRoller. According to the hosting provider, this query actually affected the DB performance heavily and affected other clients.

    This query looks like this and is located in the theme-fuctions.php:

    Code:
    SELECT ID FROM wp_jobroller_posts WHERE ID NOT IN ( SELECT wp_jobroller_postmeta.post_id FROM wp_jobroller_postmeta WHERE meta_key = 'geo_short_address' ) AND wp_jobroller_posts.post_status = 'publish')';
    I put my site in to maintenance mode and tried to run the query in phpmyadmin and YES, it took about 10 seconds to run it every time.

    However, I THINK there’s a really quick workaround to reduce the query time a lot, just by changing the order of the query to this:

    Code:
    SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish'  AND ID NOT IN ( SELECT $wpdb->postmeta.post_id FROM $wpdb->postmeta WHERE meta_key = 'geo_short_address' )';
    Now this query generates an answer in 0.5 seconds compared to 10 seconds before and you’re basically asking the DB exactly the same thing.

    I wonder:

    Is this maybe a solution the developers could implement in future versions of JR?


    My JR site has:

    About 120 published job ads and about 1 300 private.
    About 15 000 visits / month
    About 45 000 page views / month.

    Best regards,

    Ville

  2. #2
    Senior Member bbuster79's Avatar
    Join Date
    Jan 2011
    Location
    United States
    Posts
    106
    Thanks
    5
    Thanked 10 Times in 7 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Indeed query in theme_indeed.php
    By ncarrev in forum JobRoller General Discussion
    Replies: 0
    Last Post: August 15th, 2011, 12:46 PM
  2. need SQL query for pruning old ads
    By muhabat in forum Report ClassiPress Bugs
    Replies: 5
    Last Post: August 8th, 2011, 08:23 AM
  3. Search query
    By mario174 in forum JobRoller General Discussion
    Replies: 7
    Last Post: June 24th, 2011, 12:44 AM
  4. [SOLVED] Featured ads query
    By lausha in forum ClassiPress General Discussion
    Replies: 2
    Last Post: February 28th, 2011, 06:10 AM