The code contains too many “SELECT *” requests

Why you should care

A query that retrieves all columns of a table with a SELECT * or SELECT SINGLE * can potentially be the source of important performance problems: Such performance problems may arise when the execution of the query returns a large result sets (many row with all the columns may then become a huge amount of data to transport over the network). However, there are some exceptions with standard tables such as parameter tables.

Also, when using such queries, one cannot control how the columns will be ordered and returned to the client. This can lead to important data inconsistencies and thus stability issues.

5362

CAST Recommendations

Limit the number of field selected by naming those which are expecting only.

How we detect

This Code Insight counts one occurrence each time a “SELECT *” or “SELECT SINGLE *” query is found.
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.