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) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".