Home Forums SQL Server 2008 T-SQL (SS2K8) One to Many relationship in Join performance issue RE: One to Many relationship in Join performance issue

  • Re1 (11/27/2015)

    tbl_documents table is having 700 rows and tbl_documentdetails table is having 1.6 millions+ rows.

    I have created index on tbl_documentdetails table on invoiceid,orderid,billid column as per sequence used in join condition.

    If you (almost) always use invoiceid to do lookups on tbl_documentdetails -- and from this code it seems you probably do -- then try clustering tbl_documentdetails on ( invoiceid, orderid, billid ). That is, that table's clustered index should be on those columns, not just a nonclustered index.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.