Rule Definition
Having complex queries in Artifacts can cause performance problems. Queries using group by are considered complex and not efficient.
Remediation
Check the statement and if so, review the design of the statement to avoid if possible the GROUP BY clause.
Violation Code Sample
The following query should be reviewed:
Select T.title_id, T.def_id, T.publisher_id, T.pub_name into var1_title_id, var1_def_id, var1_publisher_id, var1_pub_name
from (Select ALLESQL007_TBL3.title_id, def_id, publisher_id, pub_name from ALLESQL007_TBL1, ALLESQL007_TBL2, ALLESQL007_TBL3
where pub_id = publisher_id
and pub_name = authorname
Group By ALLESQL007_TBL3.title_id, publisher_id) T
Group By T.title_id, T.publisher_id;
Fixed Code Sample
The following query should be reviewed:
Select T.title_id, T.def_id, T.publisher_id, T.pub_name into var1_title_id, var1_def_id, var1_publisher_id, var1_pub_name
from (Select ALLESQL007_TBL3.title_id, def_id, publisher_id, pub_name from ALLESQL007_TBL1, ALLESQL007_TBL2, ALLESQL007_TBL3
where pub_id = publisher_id
and pub_name = authorname
Group By ALLESQL007_TBL3.title_id, publisher_id) T
Group By T.title_id, T.publisher_id;
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.