# Mysql::Error: The SELECT would examine more than MAX\_JOIN\_SI

**URL:** <https://www.ruby-forum.com/t/mysql-the-select-would-examine-more-than-max-join-si/165282>\
**Category:** IT\
**Created:** [April 11, 2009, 12:44pm UTC](https://www.ruby-forum.com/t/mysql-the-select-would-examine-more-than-max-join-si/165282 "2009-04-11T12:44:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![salil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@salil](https://www.ruby-forum.com/u/salil)\
**Post date:** [April 11, 2009, 12:44pm UTC](https://www.ruby-forum.com/t/mysql-the-select-would-examine-more-than-max-join-si/165282/1 "2009-04-11T12:44:31Z")

</div>

Hi All,

how to SET SQL\_BIG\_SELECTS=1  
or SET SQL\_MAX\_JOIN\_SIZE=#

I get following error

ActiveRecord::StatementInvalid (Mysql::Error: 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:

when i executing following query

SELECT z.state, sum(s.royalty\_price) as royalty\_price, sum(s.units) as  
units FROM sales\_reports s, zip\_codes z  
WHERE download\_date BETWEEN ‘2010-01-01 00:00:00’ AND ‘2010-12-31  
00:00:00’ &&  
artist\_name in (“10 Fold”,“54 Seconds”,“Aaron David Gleason”,“Aaron  
LaCrate”,“Adjoa Skinner”,“Ajay”,“Alexa Ray Joel”,“Alien Breed”,“Alkaline  
Trio”,“Alucard”,“Aly and AJ”,“Amelia”,“An-Ya”,“Anxious Bench”,“Art  
Brut”,“Artistz”,“Assassin”,“Attack! Attack! UK”,“Attic Black”,“Austin  
Poole”,“Autumn Hour”,“Bank-Roll”,“Battle Alaska”,“Benjy Davis  
Project”,“Benny Strange”,“Bernie Williams”,“Bert Jones”,“Black  
Gold”,“Black Lips”,“Blackberry Smoke”,“Bleu Collar”,“Blind Melon”,“Bling  
Dawg”,“Bobby Evans”,“Body & Soul”,“Bogeymen”,“Born Jamericans”,“Bounty  
Killer”,“Boy Hits Car”,“Brad Sweitzer”,“Brantley Catlette”,“Brett  
Dennen”,“Brian & Tony G.”,“Brooke Miller”,“Cactus Hill”,“Carla  
Bruni”,“Carlos Pena”,“Ce’Cile”,“Chad Van Rys”,“Chaos Theory”,“Cheetah  
Girls”,“Chris Volz”,“Citizen Reign”,“Civil Savages”,“Cliff  
Hudson”,“Coconut Records”,"Colby Odonis ",“Cold War Kids”,“Colorless  
Green Ideas”,“Concordia Publishing House”,“Cory  
Lamb”) && royalty\_currency = ‘USD’ && z.zip\_code=s.postal\_code

GROUP BY z.state ORDER BY royalty\_price desc LIMIT 10):

Regards

Salil
