query taking too much time

Viewed 50

Below query taking too much time for exectuion. The is index on Date of Birth. Is there anything more to do make it fast

SELECT * FROM Member_dtls WHERE
DATEADD(year, 10, DateOfBirth) < GETDATE()
1 Answers

Yes, make it SARGable (here by avoiding expression on column that is indexed):

SELECT * FROM Member_dtls 
WHERE DateOfBirth < DATEADD(year, -10, GETDATE())
                    -- this part is "constant"
Related