SQL/MX 2.x Database and Application Migration Guide (G06.23+, H06.04+, J06.03+)

Version Management and Interoperability
HP NonStop SQL/MX Database and Application Migration Guide540435-005
2-14
Managing SQL/MX Query Plan Versions
Managing SQL/MX Query Plan Versions
To manage SQL/MX applications between different releases of NonStop SQL/MX, you
need to understand query plan versioning, as described in the following subsections:
Query Plan Versioning in SQL/MX Releases 2.x on page 2-14
Compiling Mixed-Version Queries on page 2-15
Query Plan Versioning in SQL/MX Releases 2.x
In SQL/MX Release 2.x, the query execution plan of an SQL statement has a plan
version equal to the earliest MXV of all its referenced nodes. If the MXV of the node
where you compile the application is lower than or equal to the referenced nodes’
MXVs, the plan version is equal to the MXV of the local node.
The default compiler can generate plans with different versions. Therefore, the query
execution plans in a user module can have different plan versions than the module
version.
Compilation on a SQL/MX Node
Applications compiled on a SQL/MX node can query database objects on any node
running the same version of the software, and on nodes running different versions
ranging from SQL/MX Release 2.0 through SQL/MX Release 2.3.4.
The SQL/MX compiler generates query execution plans with the current plan version. If
references to database objects are on a node running a lower version of the software,
the plan version supported by the SQL/MX compiler on the node running the lowest
version of the software is used to generate the query execution plans.
Table 2-5
lists the plan versions supported by the different releases of the SQL/MX
compiler. For example:
If a query is compiled on a node running SQL/MX Release 2.3.4 and all the objects
referenced by the query are on a node running SQL/MX Release 2.3.4, the plan
version of the query execution plan is 2400.
If a query is compiled on a node running SQL/MX Release 2.3.4 and one or more
objects referenced by the query are on a node running SQL/MX Release 2.3.3, the
plan version of the query execution plan is 2200.
If a query is compiled on a node running SQL/MX Release 2.3.4 and one or more
objects referenced by the query are on a node running SQL/MX Release 2.3.3
while some other objects are on a node running SQL/MX Release 2.3, the plan
version of the query execution plan is 1600.
The user modules are always generated with the current module version even though
the query execution plans in them might have lower plan versions.