Parameter markers in place of host variables
If you have host variables in a predicate for an original query in a static application and if you are using QMF or SPUFI to execute EXPLAIN for the query, you should consider using parameter markers where you use host variables in the original query.
If you use a constant value
instead, you might see different access paths for your static and
dynamic queries. For instance, compare the queries in the following
table:
Original Static SQL | QMF Query Using Parameter Marker | QMF Query Using Literal |
---|---|---|
|
|
|
Using the constant '10' would likely produce a different filter
factor and might produce a different access path from the original
static SQL statement. (A filter factor is the proportion of rows that
remain after a predicate has "filtered out" the rows that
do not satisfy the predicate. The parameter marker behaves just like
a host variable, in that the predicate is assigned a default filter
factor.