The code contains too many queries leading to a high number of table columns

Why you should care

Complex select clauses, i.e select clauses with many column can be difficult to read and does not help the reader who needs to identify the relevant columns to be retrieved. Also a query that retrieves many columns can potentially cause performance problems: Such performance problems may arise when the execution of the query returns a large result sets (many row with many colums may then become a huge amount of data to transport over the network).

CAST Recommendations

Avoid Artifacts with a SELECT clause returning more than 9 columns, with a ‘SELECT *’ query or with a ‘SELECT ALL’ query for Artifacts. Such queries are considered complex. Review the SELECT statement to reduce the number of selected columns.

How we detect

This Code Insight counts one occurrence each time an SQL query on more than 9 tables or a “SELECT *” are detected.

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.