Results 1 to 6 of 6

Thread: Slow Query in Subcategories

  1. #1
    Thread Starter
    Member silver's Avatar
    Join Date
    Mar 2011
    Location
    Germany
    Posts
    78
    Thanks
    11
    Thanked 7 Times in 4 Posts

    Slow Query in Subcategories

    HI,

    when a user is searching for ads in a specific category, classipress/wordpress is generating this MONSTER query:

    PHP Code:
    SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  INNER JOIN wp_term_relationships ON (wp_posts.ID wp_term_relationships.object_idINNER JOIN wp_postmeta ON (wp_posts.ID wp_postmeta.post_idLEFT JOIN (SELECT wp_postmeta.post_id AS IDCAST(REPLACE(wp_postmeta.meta_value',''') AS SIGNED) AS price FROM wp_postmeta WHERE wp_postmeta.meta_key ="cp_price"P ON (P.ID wp_posts.IDWHERE 1=1  AND ( wp_term_relationships.term_taxonomy_id IN (21) ) AND wp_posts.post_type 'ad_listing' AND (wp_posts.post_status 'publish' OR wp_posts.post_status 'private') AND (wp_postmeta.meta_key 'cp_price' GROUP BY wp_posts.ID  LIMIT 010
    This query is ok IF YOU HAVE ONLY 10, 20 ads in the category, but we have hundreds and thousands ads in
    categories and subcategories.

    For a category that have over 8600 ads the query took (on a development machine with iCore 5 and 4 GB RAM) over 56 sec. And again, it's a development box with no load, on the production system this will be a overkill.

    Here the log from slow-query log (have truncated the sql query, is the same as in above code section):

    Code:
    # Time: 120310 22:49:33
    # User@Host: XXXXXXXX[XXXXXXXX] @ localhost []
    # Query_time: 56.182569  Lock_time: 0.000129 Rows_sent: 10  Rows_examined: 763051458
    SET timestamp=1331416173;
    SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts   .... GROUP BY wp_posts.ID  LIMIT 0, 10;
    My dear ClassiPress Support, please help. How to avoid this ?

    I also see that on the Home-Page, where i have the "Just Listed"/"Random" Ads, the paging trough the "Pagination" is working very fast. I know you have a solution but how to implement it here where we have categories full with ads.

    Best regards,
    silver
    p.s.
    I'm using 3.1.7 classipress
    Last edited by silver; March 10th, 2012 at 05:08 PM. Reason: version added

  2. #2
    Thread Starter
    Member silver's Avatar
    Join Date
    Mar 2011
    Location
    Germany
    Posts
    78
    Thanks
    11
    Thanked 7 Times in 4 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. The Following User Says Thank You to silver For This Useful Post:

    cyjambo (August 2nd, 2013)

  4. #3
    Junior Member cyjambo's Avatar
    Join Date
    Apr 2012
    Location
    Austria
    Posts
    45
    Thanks
    11
    Thanked 4 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  6. #5
    Thread Starter
    Member silver's Avatar
    Join Date
    Mar 2011
    Location
    Germany
    Posts
    78
    Thanks
    11
    Thanked 7 Times in 4 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. #6
    Junior Member cyjambo's Avatar
    Join Date
    Apr 2012
    Location
    Austria
    Posts
    45
    Thanks
    11
    Thanked 4 Times in 2 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. Very slow SQL query
    By penev75 in forum Report ClassiPress Bugs
    Replies: 6
    Last Post: August 2nd, 2013, 11:01 AM
  2. Why so slow?
    By jgiacchino in forum MapPress
    Replies: 2
    Last Post: July 6th, 2013, 01:10 PM
  3. Jomark Slow query logs, and my hosting partner pulled down my site
    By harrybarry in forum Report JobRoller Bugs
    Replies: 3
    Last Post: January 31st, 2013, 10:41 AM
  4. Indeed Query Only Pulling First Query
    By jlei1989 in forum Report JobRoller Bugs
    Replies: 4
    Last Post: February 15th, 2012, 05:32 AM
  5. page loads very slow after i entered lots of categories and subcategories..
    By andriuskrutoi in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: February 7th, 2012, 01:14 AM