[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Surprised someone missed this one..



SELECT ea.id, p.password
                  FROM email_addresses ea
                     , user_resources ur
                     , user_pwds p
               WHERE ea.user_resource_id = ur.id
                 AND ur.user_id = p.user_id
                 AND p.password_type = 'MD5'
                 AND lower(ea.email_name)||'@'||lower(ea.domain) = '$email'"

That uses both concatanation, and the lower function. In Oracle at least, that 
would prevent it from using the index.  Right now that query alone is taking 
15 seconds, but the query without the 'lower' is instantaneous.
Unless this is a cached query, which I doubt, it is obvious that query needs 
to be fixed.

-- 
--
"Catch the Magic of Linux..."
--------------------------------------------------------
Michael Peddemors - Senior Consultant
LinuxAdministration - Internet Services
NetworkServices - Programming - Security
Wizard IT Services http://www.wizard.ca
Linux Support Specialist - http://www.linuxmagic.com
LinuxMagic is a Registered TradeMark of Wizard Tower TechnoServices Ltd.
--------------------------------------------------------
(604)589-0037 Beautiful British Columbia, Canada