Forum: Italian Ruby user group Mysql::Error: The SELECT would examine more than MAX_JOIN_SI

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Salil G. (Guest)
on 2009-04-11 14:44
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
This topic is locked and can not be replied to.