public function foo() {
...
$baseQuery = "SELECT * FROM users"; // Noncompliant
...
}
Database servers have to resolve schema fields when using asterisk symbol (*). Knowing and using the schema saves CPU cycles and network transfer.
public function foo() {
...
$baseQuery = "SELECT * FROM users"; // Noncompliant
...
}
public function foo() {
...
$baseQuery = "SELECT id,name, address FROM users ";
...
}
Energy: measured in joules (J)
Transfer: measured in Bytes (B)
Storage: measured in Bytes (B)
The control of these 3 impacts allows to lengthen the life of the terminals as well as reduce their energy consumption.
The ETSdiff tool allows measuring a differential on these three values and in a given context (database and fixed measurement environment).
The results generated by ETSdiff must help define the interest of the rule reported by SonarQube in the context of the code analyzed.
| Source of impacts | Compliant | Non-compliant |
|---|---|---|
Energy (J) |
0.040610499999999994 |
0.065223 |
Transfer (B) |
779232 |
2697937 |
Storage (B) |
637548827 |
637548827 |