SELECT clauses with many columns tend to be complex in nature.

Software EleganceCode Complexity

Why you should care

Artifacts with a SELECT clause tend to be complex in nature as SELECT clauses with many clauses are difficult to read and does not help the reader in identifying the columns that can be retrieved. Also a query that retrieves many columns can potentially cause performance problems as such performance problems may arise when the query is executed.

Business Impacts

It is recommended to avoid complex artifacts in the code as their complex nature can result in loss of time and slow down the innovative capabilities of the code.
These factors can make the code unsuitable for clients.

Acceleration
5362

CAST Recommendations

Instead of using SELECT, every column to be used in the query, should be explicitly listed while using a table alias.

For Example –

SELECT column1, column2, column3.  FROM TABLE

instead of

SELECT * FROM TABLE

How we detect

This code insight focuses on how functions, procedure and triggers should not have a too high cyclomatic complexity

How we detect

Complexity - SQL Queries

Ineffective Interprocess Communications: Utilizing SELECT * in SQL can create technical issues during the cloud migration process as the database application could constrained by physical machines which might using other services.  It can also disrupt the application when accessing it from the cloud.

5362

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.

See featuresHow it works