DB2 - Problem description
| Problem IT04157 | Status: Closed |
PERFORMANCE MAY BE POOR FOR QUERIES WITH A VALUES CLAUSE AND UNION OPERATOR | |
| product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
| Problem description: | |
Queries involving a VALUES clause joined to a UNION or UNION ALL
operation may experience poor performance. Affected queries may
required fully reading the table referenced by the UNION or
UNION ALL operator before applying the filtering offered by the
VALUES clause. For example in the following query can exhibit
this behaviour.
select v.*
from (
select c1, c2, c3
from (
select *
from t1
union
select *
from t2
)
) v, table(
values (?, ?),(?, ?),(?, ?),(?, ?),(?, ?)
) as c(c1, c2)
where v.c1 = c.c1
and v.c2 = c.c2;
To determine if you are affected by this issue. Gather explain
output for relevant queries and examine the db2exfmt output to
see if the TFNUM_LINT table function is joined to the UNION
result. | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 LUW v10.5 fixpack 5. * **************************************************************** | |
| Local Fix: | |
Manually rewrite the query to push the values clause into each leg of the UNION operator. | |
| Solution | |
First fixed in DB2 LUW v10.5 fixpack 5. | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 03.09.2014 13.03.2015 13.03.2015 |
| Problem solved at the following versions (IBM BugInfos) | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 10.5.0.5 |
|