
April 18th, 2007, 01:52 PM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 1
Time spent in forums: 33 m 44 sec
Reputation Power: 0
|
|
|
COALESCE function in where clause
Query with coalesce function takes less time than other queries. below is the one select query which takes 20k timerons
select * FROM tablea a
WHERE SOUNDEX( a.lastname) = SOUNDEX('pim') AND SOUNDEX( firstname) = SOUNDEX('tim')
when I add some meaning less coalesce function with 'where ' clause, it is taking less time. below is the select query with coalesce function which takes 14k timerons.
select * FROM tablea a
WHERE SOUNDEX( a.lastname) = SOUNDEX('pim') AND SOUNDEX( firstname) = SOUNDEX('tim')
and a.lastname= coalesce(a.lastname, a.lastname)
Can somebody explain how the above query taking less time than the first one. appreciate your help.
|