Performance issue

  • Hi folks,

    I have a sp:

    select top 20 a.employeeid as [ID], a.account, a.displayname as [Name], w.workphonenumber as phone, w.emailaddress as email

    from activedirectory a

    inner join WhitePage w on w.displayname = a.displayname or w.empnum = '00000' + a.employeeid

    where charindex(@query, a.account) > 0

    Basically I want to get the top 20 matches, it's working with no problem, but the performance is not that satisfied, there are 31000 records in activedirectory and 48000 in WhitePage, I wouldn't say they are big, but the query result takes

    Index has been created on: displayname(both), a.account, w.workphonenumber, w.emailaddress

    How can I improve the query's performance?

    Thanks lots.

  • Have you checked if/which indexes are being used? My thinking is the expression in the Where clause would make it non-sargable anyway.

    Maybe you could post the query plan and we could have a look.

  • Duplicate post. Please post answers here. Hopefully I won't find another one.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply