Firebird Documentation Index → Firebird 2.0.6 Release Notes → New in Firebird 2.0 → PSQL Invariant Tracking Reworked |
Invariant tracking in PSQL and request cloning logic were reworked to fix a number of issues with recursive procedures, for example SF bug #627057.
Invariant tracking is the process performed by the BLR compiler and the optimizer to decide whether an "invariant" (an expression, which might be a nested subquery) is independent from the parent context. It is used to perform one-time evaluations of such expressions and then cache the result.
If some invariant is not determined, we lose in performance. If some variant is wrongly treated as invariant, we see wrong results.
Example
select * from rdb$relations where rdb$relation_id < ( select rdb$relation_id from rdb$database )
This query performs only one fetch from rdb$database instead of evaluating the subquery for every row of rdb$relations.
Firebird Documentation Index → Firebird 2.0.6 Release Notes → New in Firebird 2.0 → PSQL Invariant Tracking Reworked |