CRITICAL
Rule Definition
Having complex queries in Programs can cause performance problems.
Remediation
The best solution is to review the query to reduce the number of FROM clauses
Violation Code Sample
105 11 C/EXEC SQL 10400
106 C+ DECLARE C2 CURSOR FOR 10500
107 C+ SELECT EMPPROJACT.PROJNO, PROJNAME, COUNT(*), 10600
108 C+ SUM((DAYS(EMENDATE) - DAYS(EMSTDATE)) * EMPTIME * 10700
109 C+ DECIMAL((SALARY/:WRKDAY),8,2)) 10800
110 C+ FROM CORPDATA/EMPPROJACT, CORPDATA/PROJECT, CORPDATA/EMPLOYEE 10900
111 C+ WHERE EMPPROJACT.PROJNO = PROJECT.PROJNO AND 11000
112 C+ EMPPROJACT.EMPNO = EMPLOYEE.EMPNO AND 11100
113 C+ PRENDATE = :RDATE 11200
114 C+ GROUP BY EMPPROJACT.PROJNO 11300
115 C+ ORDER BY 1 11400
116 C/END-EXEC 11500
Fixed Code Sample
Using Joins instead of from clauses
66 C* 6500
67 C EXCPTRECA 6600
68 6 C/EXEC SQL DECLARE C1 CURSOR FOR 6700
69 C+ SELECT DISTINCT PROJNO, EMPPROJACT.EMPNO, 6800
70 C+ LASTNAME||', '||FIRSTNME, SALARY 6900
71 C+ FROM CORPDATA/EMPPROJACT 7000
72 C+ INNER JOIN CORPDATA/EMPLOYEE 7000
72 C+ ON EMPLOYEE.ID = EMPPROJACT.PRJEMP_ID 7000
72 C+ WHERE EMPPROJACT.EMPNO = EMPLOYEE.EMPNO AND 7100
73 C+ COMM = :COMMI 7200
74 C+ ORDER BY PROJNO, EMPNO 7300
75 C/END-EXEC 7400
76 C* 7500
77 7 C/EXEC SQL 7600
Related Technologies
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.