Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15694

Reports Query Optimisation

$
0
0

FROM PAYROLLMGR.Timecard tc INNER JOIN PAYROLLMGR.EmpAssignment ea ON tc.EmpAssignmentID = ea.id
INNER JOIN PAYROLLMGR.Employee e ON e.id=ea.empid INNER JOIN PAYROLLMGR.LocationJobPhase ljp ON ea.LocationJobPhaseID=ljp.ID
INNER JOIN PAYROLLMGR.JobMaster ljpjm ON ljp.JobMasterID=ljpjm.ID
INNER JOIN PAYROLLMGR.DailyEntries de on tc.id=de.TimecardID
INNER JOIN PAYROLLMGR.ChargeJobTimecardAttr cjta on tc.id=cjta.TimecardID
INNER JOIN PAYROLLMGR.ChargeJobPhase cjp on cjta.ChargeJobPhaseID = cjp.id
INNER JOIN PAYROLLMGR.TimeEntries te on cjta.id = te.ChargeJobTimecardAttrID and de.id=te.DailyEntriesID
INNER JOIN PAYROLLMGR.ListItem li ON li.Name=cjta.EarnType 
INNER JOIN  PAYROLLMGR.Foreman fmn ON ea.ForemanID = fmn.ID
INNER JOIN PAYROLLMGR.JobWeekEnding jwe ON tc.JobWeekendingID=jwe.ID
INNER JOIN PAYROLLMGR.JobMaster cjpjm ON cjp.JobMasterID=cjpjm.ID
INNER JOIN PAYROLLMGR.LocationJobPhase fmnljp ON fmn.LocationJobPhaseID=fmnljp.ID
INNER JOIN PAYROLLMGR.JobMaster fmnjm ON fmnljp.JobMasterID=fmnjm.ID
LEFT JOIN PAYROLLMGR.ABCSubDistribution abcsd on abcsd.id = te.ABCSubDistributionId

The above query is common in most of the reports, which is taking around 50 seconds to load data. The query is getting generated on the runtime from Dot Net layer and we have been adviced not to write any stored procedure or database objects since tomrrow if Client wants to move to different database such as Oracle they want to make minimum changes.

PAYROLLMGR.TimeEntries(Record Count 674605)

,PAYROLLMGR.DailyEntries( Record Count 674605) are the two tables which is having around lakhs of record rest is having around 1000 records max and all are OLTP tables.  We verified proper Index on those tables with DTA also and it seems fine.

Could you please suggest if table partition or any other methodology could help .


Viewing all articles
Browse latest Browse all 15694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>