Sunday, August 28, 2016

SQL Performance - CA PPM - Unnecessary Joins

Remove unnecessary tables from queries

Avoid falling back on common tables


  • INV_INVESTMENTS
  • SRM_RESOURCES

Query to find role allocation hours on a project

SELECT SUM(TM.PRALLOCSUM/3600) HOURS
FROM INV_INVESTMENTS INVI
JOIN PRTEAM TM ON INVI.ID=TM.PRPROJECTID
JOIN SRM_RESOURCES SRMR  ON TM.PRRESOURCEID=SRMR.ID
JOIN PRJ_RESOURCES PRJR ON SRMR.ID=PRJR.ID
WHERE INVI.ID=50000001 AND PRJR.PRISROLE=1




in this case not require to link with SRM_RESOURCES only PRJ_RESOURCES is enough.