pgsql: Tweak genericcostestimate's fudge factor for index size. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Tweak genericcostestimate's fudge factor for index size.
Date
Msg-id E1TR7X5-0000H5-RC@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Tweak genericcostestimate's fudge factor for index size.

To provide some bias against using a large index when a small one would do
as well, genericcostestimate adds a "fudge factor", which for a long time
was random_page_cost * index_pages/10000.  However, this can grow to be the
dominant term in indexscan cost estimates when the index involved is large
enough, a behavior that was never intended.  Change to a ln(1 + n/10000)
formulation, which has nearly the same behavior up to a few hundred pages
but tails off significantly thereafter.  (A log curve seems correct on
first principles, since what we're trying to account for here is index
descent costs, which are typically logarithmic.)  Per bug #7619 from Niko
Kiirala.

Possibly this change should get back-patched, but I'm hesitant to mess with
cost estimates in stable branches.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/bf01e34b556ff37982ba2d882db424aa484c0d07

Modified Files
--------------
src/backend/utils/adt/selfuncs.c |   12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Prevent parser from believing that views have system columns.
Next
From: Tom Lane
Date:
Subject: pgsql: In pg_dump, dump SEQUENCE SET items in the data not pre-data sec