On 10/24/07, Gerard <[EMAIL PROTECTED]> wrote:
> Currently I am running a concat statement to combine a field with a user
> name and domain to create and email address. In testing it looks like
> running the concat is a very slow command to run. The select statement
> currently looks like this.
>
> select concat(user,'@',domain),servername,port from database where
> concat(user,'@',domain)='[EMAIL PROTECTED]';
>
That query will be very slow because mysql will have to examine each
row. You would be far better served to do something like
select concat(user,'@',domain),servername,port
from database
where
user = substring('[EMAIL PROTECTED]',0,LOCATE('@','[EMAIL PROTECTED]'))
AND
domain = substring('[EMAIL PROTECTED]',LOCATE('@','[EMAIL PROTECTED]'))

or something like that, or even better split it outside mysql if possible.
-- 
Rob Wultsch
(480)223-2566
[EMAIL PROTECTED] (email/google im)
wultsch (aim)
[EMAIL PROTECTED] (msn)

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

Reply via email to