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: [EMAIL PROTECTED]        mob: +1 614 406 1267

Are You MySQL Certified? http://www.mysql.com/certification
Got Cluster? http://www.mysql.com/cluster

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to