aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-08-24 15:14:17 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-08-24 15:14:17 -0400
commit2aac3399aef47e40d688f3eee3f92b6deea2f974 (patch)
treeac767670a100d7675f5d9054ac57de7e7b758989 /src/backend/executor/nodeModifyTable.c
parentdb4ef737606e340479d68f63f33bc7d21f937ca7 (diff)
downloadpostgresql-2aac3399aef47e40d688f3eee3f92b6deea2f974.tar.gz
postgresql-2aac3399aef47e40d688f3eee3f92b6deea2f974.zip
Account better for planning cost when choosing whether to use custom plans.
The previous coding in plancache.c essentially used 10% of the estimated runtime as its cost estimate for planning. This can be pretty bogus, especially when the estimated runtime is very small, such as in a simple expression plan created by plpgsql, or a simple INSERT ... VALUES. While we don't have a really good handle on how planning time compares to runtime, it seems reasonable to use an estimate based on the number of relations referenced in the query, with a rather large multiplier. This patch uses 1000 * cpu_operator_cost * (nrelations + 1), so that even a trivial query will be charged 1000 * cpu_operator_cost for planning. This should address the problem reported by Marc Cousin and others that 9.2 and up prefer custom plans in cases where the planning time greatly exceeds what can be saved.
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
0 files changed, 0 insertions, 0 deletions