Performance problem on a query.
Posted
by yapiskan
on Stack Overflow
See other posts from Stack Overflow
or by yapiskan
Published on 2010-04-15T17:13:19Z
Indexed on
2010/04/15
17:23 UTC
Read the original article
Hit count: 124
sql-server
|tsql
Hi,
I have a performance problem on a query.
First table is a Customer table which has millions records in it. Customer table has a column of email address and some other information about customer.
Second table is a CommunicationInfo table which contains just Email addresses.
And What I want in here is; how many times the email address in CommunicationInfo table repeats in Customers table. What could be the the most performer query.
The basic query that I can explain this situation is;
Select ci.Email, count(*) from Customer c left join
CommunicationInfo ci on c.Email1 = ci.Email or c.Email2 = ci.Email
Group by ci.Email
But sure, it takes about 5, 6 minutes in execution.
Thanks in Advance.
© Stack Overflow or respective owner