Why you should care
Having Complex queries in SQL Artifacts lead to causing performance problems and decrease in code agility. Subqueries are considered to be complicated in nature.
Complex queries are not recommended as they reduce code agility thereby increasing costs.
Subqueries are generally considered fine unless they are dependent subqueries therefore it is recommended for developers to use independent subqueries with appropriate indexes.
A subquery is independent if it can be run without context and those should be used for added performance.
How we detect
This code insight shows that artifacts should not use SQL statements including subqueries or at the very least subqueries should be avoided.
About CAST and Highlight’s Code Insights
Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.