WordPress.org

Ready to get started?Download WordPress

Forums

Content Aware Sidebars
[resolved] WordPress database error (7 posts)

  1. jewlzmcq
    Member
    Posted 2 years ago #

    I'm getting a wordpress database error:

    WordPress database error The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay for query

    There is a lot more code, shown below, but it all references content aware sidebars. My site is hosted and I cannot adjust the MAX_JOIN_SIZE.

    Is there any way to reduce the demand on the database - reduce the rows?

    Full error message:

    WordPress database error The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay for query
    SELECT
    posts.ID,
    handle.meta_value handle,
    host.meta_value host,
    merge_pos.meta_value merge_pos
    FROM wp_posts posts
    LEFT JOIN wp_postmeta handle
    ON handle.post_id = posts.ID
    AND handle.meta_key = '_cas_handle'
    LEFT JOIN wp_postmeta host
    ON host.post_id = posts.ID
    AND host.meta_key = '_cas_host'
    LEFT JOIN wp_postmeta merge_pos
    ON merge_pos.post_id = posts.ID
    AND merge_pos.meta_key = '_cas_merge-pos'
    LEFT JOIN wp_postmeta exposure
    ON exposure.post_id = posts.ID
    AND exposure.meta_key = '_cas_exposure'
    LEFT JOIN wp_term_relationships term ON term.object_id = posts.ID LEFT JOIN wp_term_taxonomy taxonomy ON taxonomy.term_taxonomy_id = term.term_taxonomy_id LEFT JOIN wp_terms terms ON terms.term_id = taxonomy.term_id LEFT JOIN wp_postmeta post_tax ON post_tax.post_id = posts.ID AND post_tax.meta_key = '_cas_taxonomies'LEFT JOIN wp_postmeta post_types ON post_types.post_id = posts.ID AND post_types.meta_key = '_cas_post_types' LEFT JOIN wp_postmeta authors ON authors.post_id = posts.ID AND authors.meta_key = '_cas_authors'
    WHERE
    posts.post_type = 'sidebar' AND
    (post_tax.meta_value LIKE '%category%' OR terms.slug IN('events','education','volunteers') ) OR ((post_types.meta_value IS NULL OR (post_types.meta_value LIKE '%s:4:"post";%' OR post_types.meta_value LIKE '%s:4:"2975";%')) AND (authors.meta_value IS NULL OR (authors.meta_value LIKE '%authors%' OR authors.meta_value LIKE '%s:1:"1";%'))AND (post_types.meta_value IS NOT NULL OR authors.meta_value IS NOT NULL)) AND exposure.meta_value <= '1' AND posts.post_status = 'publish'
    GROUP BY posts.ID
    ORDER BY posts.menu_order ASC, handle.meta_value DESC, posts.post_date DESC
    made by require, wp, WP->main, do_action_ref_array, call_user_func_array, ContentAwareSidebars->replace_sidebar, ContentAwareSidebars->get_sidebars

    http://wordpress.org/extend/plugins/content-aware-sidebars/

  2. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the feedback. The sql call is quite heavy, yes. It might be split into several calls in the future - I'll have to test what is fastest in general.

    Now, in order to fix your problem right now, I think you can just replace line 611 (version 0.8.2) in content-aware-sidebars.php with the following:

    SET OPTION SQL_BIG_SELECTS = 1; SELECT

    Please write again if this does not fix it or if you experience that the plugin makes your site much slower.

  3. jewlzmcq
    Member
    Posted 2 years ago #

    when I replace line 611 (version 0.8.2) with
    SET OPTION SQL_BIG_SELECTS = 1; SELECT
    it makes the entire plugin stop functioning. All sidebars go back to the default and none that I setup in content aware sidebars show up.

    should it look exactly like you type above or is there something else I need to put into the code to make it work?

  4. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry, it was SET SESSION SQL_BIG_SELECTS = 1; SELECT and not OPTION.

    Does this work? It ought to be the only thing to do, yes.

  5. jewlzmcq
    Member
    Posted 2 years ago #

    no. the sidebars go back to the defaults with this also.

  6. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Well that's odd. SET SESSION SQL_BIG_SELECTS = 1; SELECT really should tell that it's okay to run the query even though it exceeds the limit settings set by your server. Try to insert

    $wpdb->query('SET OPTION SQL_BIG_SELECTS = 1');

    right before the sql call (line 609).

    Did you experience the problem in earlier versions or have you switched host recently?

    Unfortunatly I do not have time to look further into the problem right now, but if the beforementioned code does not work, I suggest that you remove some of the rules you don't use for the singular pages (I assume that you only get the error on singular pages with taxonomies?)

  7. jewlzmcq
    Member
    Posted 2 years ago #

    that worked. thank you so much.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic