Skip to content

BSL273 — Virtual table call without parameters

Summary

Virtual table call without parameters

Identifiers

Field Value
Rule code BSL273
Compatible alias VirtualTableCallWithoutParameters
Severity WARNING
Enabled by default Yes
Implemented Yes
Tags query, performance

Behavior

  • The public identifier BSL273 and alias VirtualTableCallWithoutParameters are stable.
  • The rule reports the cases documented on this page.
  • Suppressions and project configuration are applied before publication.
  • The rule requires neither an external analyzer nor network access.

Configuration and suppression

BSL### is the primary stable identifier. The compatible alias is accepted in select, ignore, and compatible block suppression comments.

[tool.onec-hbk-bsl]
select = ["BSL273"]
ignore = ["VirtualTableCallWithoutParameters"]

All three suppression families support both a current line and a range. When an opening comment follows code, it affects only that line. Use any one form:

  • noqa:
Value = "example";  // noqa: BSL273
  • bsl-disable:
Value = "example";  // bsl-disable: BSL273
  • compatible BSLLS form:
Value = "example";  // BSLLS:VirtualTableCallWithoutParameters-off

When the same opening comment is on a line by itself, it starts a range. Close it with the matching marker from the same family:

// noqa: BSL273
// code without this diagnostic
// noqa-enable: BSL273

// bsl-disable: BSL273
// code without this diagnostic
// bsl-enable: BSL273

// BSLLS:VirtualTableCallWithoutParameters-off
// code without this diagnostic
// BSLLS:VirtualTableCallWithoutParameters-on

To disable the rule until the end of the file, omit the closing noqa-enable, bsl-enable, or BSLLS:…-on marker.

Opening and closing markers must belong to the same family.

Description

When using virtual tables in queries, you should specify all conditions related to it in the table parameters.

It is not recommended to refer to virtual tables using conditions in the WHERE section, etc.

Such a query will return the correct (in terms of functionality) result, but it will be much more difficult for the DBMS to choose the optimal plan for its execution. In some cases, this can lead to errors in the DBMS optimizer and a significant slowdown in query performance.

Examples

For example, a query uses the WHERE section to filter virtual table data:

Query.Text = "SELECT
| Good
|FROM
| AccumulationRegister.MyGoods.Turnovers()
|WHERE
| Warehouse = &Warehouse";
When executing this query, first all records of the virtual table will be selected, then the part corresponding to the specified condition will be selected from them.

It is recommended that you limit the number of selected records as early as possible. To do this, pass conditions to the parameters of the virtual table.

Query.Text = "SELECT
| Good
|FROM
| AccumulationRegister.MyGoods.Turnovers(, Warehouse = &Warehouse)";

Sources