With DB2 10.5.6 x64 on Ubuntu 14.04.3, In the case of a SELECT from DML in a CTE where you just want the INSERT done but not return any rows to the CTE like:
cte1 (null) as
from final table
(insert into ... col1 not null ...)
>>no WHERE clause here returns null row for each row in final table to cte1 but I don't want to return any rows<<
According to db2batch timing runs, both of the below WHERE clauses are much faster (and have equal times) than no WHERE clause because it reduces the rows returned to 0, which is great!!
WHERE 0 = 1
WHERE col1 is null
but because they both have equal times doesn't that mean that WHERE 0=1 is checking each row? Isn't there an always false predicate, or some other magic that tells the optimizer to not return any rows AND to not bother searching each row as well?