pgsql: Increase DEFAULT_FDW_TUPLE_COST from 0.01 to 0.2 - Mailing list pgsql-committers

From David Rowley
Subject pgsql: Increase DEFAULT_FDW_TUPLE_COST from 0.01 to 0.2
Date
Msg-id E1qyMYT-003VkZ-Mc@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Increase DEFAULT_FDW_TUPLE_COST from 0.01 to 0.2

0.01 was unrealistically low as it's the same as the default
cpu_tuple_cost and 10x cheaper than the default parallel_tuple_cost.
It's hard to imagine a situation where fetching a tuple from a foreign
server would be cheaper than fetching one from a parallel worker.

After some experimentation on a loopback server, somewhere between 0.15
and 0.3 seems more realistic.  Here we split the difference and set it
to 0.2.

This will cause operations that reduce the number of tuples (e.g.
aggregation) to be more likely to take place on the foreign server.

Adjusting this causes some plan changes in the postgres_fdw regression
tests.  This is because penalizing each Path with the additional tuple
costs causes some dilution of the costs of the other operations being
charged for and results in various paths appearing to be closer to the
same costs such that add_path's STD_FUZZ_FACTOR is more likely to see two
paths as costing (fuzzily) the same.  This isn't ideal, but it shouldn't
be reason enough to use artificially low costs.

Discussion: https://postgr.es/m/CAApHDvopVjjfh5c1Ed2HRvDdfom2dEpMwwiu5-f1AnmYprJngA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cac169d686eddb277880a0d8a760ac3007b4846a

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 129 ++++++++++++-------------
contrib/postgres_fdw/postgres_fdw.c            |   2 +-
2 files changed, 62 insertions(+), 69 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: doc: Replace reference to ERRCODE_RAISE_EXCEPTION by "raise_exce
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix 003_check_guc.pl when loading modules with custom GUCs