Firebird Documentation IndexFirebird 2.0.6 Release NotesNew in Firebird 2.0 → PSQL Invariant Tracking Reworked
Firebird Home Firebird Home Prev: Improved Connection Handling on POSIX SuperserverFirebird Documentation IndexUp: New in Firebird 2.0Next: ROLLBACK RETAIN Syntax Support

PSQL Invariant Tracking Reworked

N. Samofatov

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.

Prev: Improved Connection Handling on POSIX SuperserverFirebird Documentation IndexUp: New in Firebird 2.0Next: ROLLBACK RETAIN Syntax Support
Firebird Documentation IndexFirebird 2.0.6 Release NotesNew in Firebird 2.0 → PSQL Invariant Tracking Reworked