Title: [Plugin: Content Aware Sidebars] WordPress database error
Last modified: August 20, 2016

---

# [Plugin: Content Aware Sidebars] WordPress database error

 *  Resolved [jewlzmcq](https://wordpress.org/support/users/jewlzmcq/)
 * (@jewlzmcq)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/)
 * 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/](http://wordpress.org/extend/plugins/content-aware-sidebars/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/#post-2644269)
 * 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.
 *  Thread Starter [jewlzmcq](https://wordpress.org/support/users/jewlzmcq/)
 * (@jewlzmcq)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/#post-2644313)
 * 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?
 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/#post-2644319)
 * 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.
 *  Thread Starter [jewlzmcq](https://wordpress.org/support/users/jewlzmcq/)
 * (@jewlzmcq)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/#post-2644323)
 * no. the sidebars go back to the defaults with this also.
 *  Plugin Author [Joachim Jensen](https://wordpress.org/support/users/intoxstudio/)
 * (@intoxstudio)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/#post-2644369)
 * 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?)
 *  Thread Starter [jewlzmcq](https://wordpress.org/support/users/jewlzmcq/)
 * (@jewlzmcq)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/#post-2644383)
 * that worked. thank you so much.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘[Plugin: Content Aware Sidebars] WordPress database error’ is closed 
to new replies.

 * ![](https://ps.w.org/content-aware-sidebars/assets/icon-256x256.png?rev=1815877)
 * [Content Aware Sidebars - Fastest Widget Area Plugin](https://wordpress.org/plugins/content-aware-sidebars/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-aware-sidebars/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-aware-sidebars/)
 * [Active Topics](https://wordpress.org/support/plugin/content-aware-sidebars/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-aware-sidebars/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-aware-sidebars/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [jewlzmcq](https://wordpress.org/support/users/jewlzmcq/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-content-aware-sidebars-wordpress-database-error/#post-2644383)
 * Status: resolved