List:General Discussion« Previous MessageNext Message »
From:Jay Pipes Date:June 21 2006 4:21pm
Subject:Re: query slow
View as plain text  
luiz Rafael wrote:
> Dear friends
> 
> is their any way to optimize this query bellow, it take +- 2minutes do 
> complete, i think it becouse their no index by the emissao field
> 
> SELECT  * FROM  `sav00_sava0400_dbf`   WHERE 2000 = YEAR(`emissao`) OR 
> (1999 = YEAR(`emissao`) AND 12 < MONTH(`emissao`))  ORDER BY emissao ASC

SELECT  * FROM  `sav00_sava0400_dbf`
emissao BETWEEN '2000-01-01' AND '2000-12-31'
UNION ALL
SELECT  * FROM  `sav00_sava0400_dbf`
emissao BETWEEN '1999-12-01' AND '1999-12-31'

-- 
Jay Pipes
Community Relations Manager, North America, MySQL Inc.
Roaming North America, based in Columbus, Ohio
email: jay@stripped	mob: +1 614 406 1267

Are You MySQL Certified? http://www.mysql.com/certification
Got Cluster? http://www.mysql.com/cluster
Thread
Just need script for creating tablesXiaobo Chen21 Jun
  • Re: Just need script for creating tablesDaniel da Veiga21 Jun
  • RE: Just need script for creating tablesPeter Lauri21 Jun
    • query slowluiz Rafael21 Jun
      • Re: query slowJay Pipes21 Jun
        • Re: query slowEugene Kosov21 Jun
      • Re: query slowEugene Kosov21 Jun
    • Re: query slowluiz Rafael21 Jun
    • reclaim disk spaceluiz Rafael21 Jun
      • Re: reclaim disk spaceDan Buettner21 Jun
      • Re: reclaim disk spaceDan Nelson21 Jun
    • Re: query slowluiz Rafael25 Jun
  • Re: Just need script for creating tablesMartin Jespersen21 Jun
RE: reclaim disk spaceGeorge Law21 Jun