Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.12
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2009 at 10:37 UTC
Updated:
9 Mar 2011 at 22:20 UTC
user warning: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay query: SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, users.name AS users_name, users.uid AS users_uid, location.lid AS location_lid, 'Unknown' AS location_distance, node.vid AS node_vid, votingapi_cache_node_percent_vote_average.value AS votingapi_cache_node_percent_vote_average_value, node.created AS node_created FROM node node LEFT JOIN votingapi_cache votingapi_cache_node_percent_vote_average ON node.nid = votingapi_cache_node_percent_vote_average.content_id AND (votingapi_cache_node_percent_vote_average.content_type = 'node' AND votingapi_cache_node_percent_vote_average.value_type = 'percent' AND votingapi_cache_node_percent_vote_average.tag = 'vote' AND votingapi_cache_node_percent_vote_average.function = 'average') LEFT JOIN votingapi_vote votingapi_vote_node_percent_vote ON node.nid = votingapi_vote_node_percent_vote.content_id AND (votingapi_vote_node_percent_vote.content_type = 'node' AND votingapi_vote_node_percent_vote.value_type = 'percent' AND votingapi_vote_node_percent_vote.tag = 'vote') INNER JOIN users users ON node.uid = users.uid LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid LEFT JOIN location location ON location_instance.lid = location.lid INNER JOIN node_access na ON na.nid = node.nid LEFT JOIN node n ON node.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'job_view') OR (na.gid = 0 AND na.realm = 'user_relationship_node_access_author') OR (na.gid = 0 AND na.realm = 'ng_private_author'))) AND ((n.moderate != 1)) AND (( CASE node.type WHEN 'stormorganization' THEN 0 WHEN 'stormproject' THEN 0 WHEN 'stormtask' THEN 0 ELSE 1 END )=1 ) AND ( (node.type in ('job_posting')) AND (node.status <> 0 OR node.uid = 0 or 0 = 1) )ORDER BY node_created DESC LIMIT 0, 30 in /home/sites/co.uk/public_html/sites/all/modules/contributions/views/includes/view.inc on line 728.
Solution is to add following line before the line with error (728):
global $db_type;
$db_type == 'mysql' ? db_query("SET OPTION SQL_BIG_SELECTS=1") : ; // added
So it will be like:
global $db_type;
$db_type == 'mysql' ? db_query("SET OPTION SQL_BIG_SELECTS=1") : ; // added
$result = db_query_range($query, $args, $offset, $this->pager['items_per_page']);
It can be moved and improved for checking after result, if $result fails with this error, increase it.
Comments
Comment #1
kenorb commentedSorry, improved code will be:
But it will be good if this functionality will be moved to some separately module or implemented into the core.
Make sure that after that you refreshed all the caches and cleared the views cache (admin/build/views/tools).
Comment #2
kenorb commentedNew module:
#361967: Increase MAX_JOIN_SIZE and MAX_ALLOWED_PACKET settings in system.install
Comment #3
kenorb commentedComment #5
matt bJust had to manually apply this code to line 771 and 775.