SQL Server Performance

Filtering name from database.

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by tran008, Jun 16, 2008.

  1. tran008 New Member

    I trying to filter over a million records that was import by the third party database. The reason for filtering is that the data contain too many junk name. The query below is taking to long to run, and I just wondering if anyone have any suggestion on how to speed thing up a bit.
    thanks
    select
    T.DocID
    from
    JunkName T
    inner join
    NameRef W on T.surname like '%' + W.CommonName + '%'
    group by
    T.docID
  2. Adriaan New Member

    Does the JunkName table have an index on Surname, and NameRef an index on CommonName?
  3. tran008 New Member

    Yes, both table have non-clustered index.
    thanks
  4. Adriaan New Member

    The indexes that you mention, are they only on the columns that I mentioned?
    Do not expect much improvement when there is a wildcard at the start of the search string.

Share This Page