Overuse "Reference" in a query (RefOveruse)¶
Type | Scope | Severity | Activated by default |
Minutes to fix |
Tags |
---|---|---|---|---|---|
Code smell |
BSL |
Major |
Yes |
5 |
sql performance |
Description¶
Using ".Ref" to a field of a reference type will result in an implicit left join with the source table of this field, and it has no value, but only generates excessive load on the DBMS.
Examples¶
Query.Text = "Select Files.File.Ref, // error
| Files.File
| From
| InternalFiles AS Files";
Sources¶
- Useful Information: Dereferencing Complex Type Reference Fields in Query Language (RU)
Snippets¶
Diagnostic ignorance in code¶
// BSLLS:RefOveruse-off
// BSLLS:RefOveruse-on
Parameter for config¶
"RefOveruse": false