aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAgg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-04-29 13:12:33 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-04-29 13:12:33 -0400
commit0901dbab338f3161b50c4c60ef669ed393c9e308 (patch)
tree4dc9bc275ea5e2654e8e8827c9646931afc562bc /src/backend/executor/nodeAgg.c
parent1e96eff43ac7f1d59800ecd78e09185689ca6704 (diff)
downloadpostgresql-0901dbab338f3161b50c4c60ef669ed393c9e308.tar.gz
postgresql-0901dbab338f3161b50c4c60ef669ed393c9e308.zip
Improve planner to drop constant-NULL inputs of AND/OR where it's legal.
In general we can't discard constant-NULL inputs, since they could change the result of the AND/OR to be NULL. But at top level of WHERE, we do not need to distinguish a NULL result from a FALSE result, so it's okay to treat NULL as FALSE and then simplify AND/OR accordingly. This is a very ancient oversight, but in 9.2 and later it can lead to failure to optimize queries that previous releases did optimize, as a result of more aggressive parameter substitution rules making it possible to reduce more subexpressions to NULL constants. This is the root cause of bug #10171 from Arnold Scheffler. We could alternatively have fixed that by teaching orclauses.c to ignore constant-NULL OR arms, but it seems better to get rid of them globally. I resisted the temptation to back-patch this change into all active branches, but it seems appropriate to back-patch as far as 9.2 so that there will not be performance regressions of the kind shown in this bug.
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
0 files changed, 0 insertions, 0 deletions