Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 index creation

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-07-15 : 10:23:44
Hi ,

Can anyone guide me to create index

This query performance very slow due to huge data.


select #wrk.*

FROM #wrk
INNER JOIN #wrkBuildHierarchy
ON BusinessEntityShortName = ParentName
WHERE COBDate = @paramCOBDate
AND RejectReason IS NULL



whether index to be created on only BusinessEntityShortName and
ParentName of the respective table

[or]

create index ind_1 on #wrk(BusinessEntityShortName ,COBDate,RejectReason)


namman
Constraint Violating Yak Guru

285 Posts

Posted - 2010-07-15 : 15:58:56
Create a clustered index on (COBDate,RejectReason)
Create a non-cluster index on (BusinessEntityShortName)
Create a noe-cluster index on (ParentName)
Go to Top of Page
   

- Advertisement -