SQL Server Performance

Slow query hash match

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by mllam_98, May 27, 2009.

  1. mllam_98 New Member

    I have a query that is running very slow the execution plan tells me it is spending a lot of time on a hash match. What can I do to make it faster?select
    COUNT(DISTINCT p.personnelID)FROM directivegroup g
    left join dbo.PersonnelGroup dgpon g.AgyGroupID_FK = dgp.AgyGroupID_FK
    inner join #TempPersonGroup pon p.personnelID = dgp.PersonnelID_FK
    OR p.personnelID = g.PersonnelID_FK-- from #TempPersonGroup pg
    -- inner join directivegroup dg
    -- on dg.AgyGroupID_FK = pg.AgyGroupID
    -- OR dg.PersonnelID_FK = pg.PersonnelIDinner join testresult tron tr.PersonnelID_FK = p.PersonnelID
    where tr.passed =1AND tr.AgencyID_FK = @AgencyID
    and g.directiveID_FK = d.directiveIDAND
    tr.directiveID_FK = d.directiveID
  2. FrankKalis Moderator

    Can you provide some more information about the table structure(s) and available indices?

Share This Page