aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gist.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-04-11 20:24:25 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-04-11 20:24:25 -0400
commit79853989c577cc90754d7562363bf802157864ae (patch)
treed7da025caa71feb7527e46171a5d121fe53499fe /src/backend/access/gist/gist.c
parent35400e14b8e0dea994862d0f16d275b35b5e31b3 (diff)
downloadpostgresql-79853989c577cc90754d7562363bf802157864ae.tar.gz
postgresql-79853989c577cc90754d7562363bf802157864ae.zip
Clamp indexscan filter condition cost estimate to be not less than zero.
cost_index tries to estimate the per-tuple costs of evaluating filter conditions (a/k/a qpquals) by subtracting the estimated cost of the indexqual conditions from that of the baserestrictinfo conditions. This is correct so long as the indexquals list is a subset of the baserestrictinfo list. However, in the presence of derived indexable conditions it's completely wrong, leading to bogus or even negative scan cost estimates, as seen for example in bug #6579 from Istvan Endredy. In practice the problem isn't severe except in the specific case of a LIKE optimization on a functional index containing a very expensive function. A proper fix for this might change cost estimates by more than people would like for stable branches, so in the back branches let's just clamp the cost difference to be not less than zero. That will at least prevent completely insane behavior, while not changing the results normally.
Diffstat (limited to 'src/backend/access/gist/gist.c')
0 files changed, 0 insertions, 0 deletions