Rename postgres_fdw's use_remote_explain option to use_remote_estimate.
The new name was originally my typo, but per discussion it seems like a better name anyway. So make the code match the docs, not vice versa.
This commit is contained in:
parent
8e8d0f7e80
commit
09a7cd409e
@ -78,7 +78,7 @@ ALTER FOREIGN TABLE ft2 DROP COLUMN c0;
|
|||||||
-- requiressl, krbsrvname and gsslib are omitted because they depend on
|
-- requiressl, krbsrvname and gsslib are omitted because they depend on
|
||||||
-- configure options
|
-- configure options
|
||||||
ALTER SERVER testserver1 OPTIONS (
|
ALTER SERVER testserver1 OPTIONS (
|
||||||
use_remote_explain 'false',
|
use_remote_estimate 'false',
|
||||||
fdw_startup_cost '123.456',
|
fdw_startup_cost '123.456',
|
||||||
fdw_tuple_cost '0.123',
|
fdw_tuple_cost '0.123',
|
||||||
service 'value',
|
service 'value',
|
||||||
@ -121,9 +121,9 @@ ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
|
|||||||
|
|
||||||
-- Now we should be able to run ANALYZE.
|
-- Now we should be able to run ANALYZE.
|
||||||
-- To exercise multiple code paths, we use local stats on ft1
|
-- To exercise multiple code paths, we use local stats on ft1
|
||||||
-- and remote_explain mode on ft2.
|
-- and remote-estimate mode on ft2.
|
||||||
ANALYZE ft1;
|
ANALYZE ft1;
|
||||||
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_explain 'true');
|
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_estimate 'true');
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- simple queries
|
-- simple queries
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
|
@ -106,9 +106,9 @@ postgres_fdw_validator(PG_FUNCTION_ARGS)
|
|||||||
/*
|
/*
|
||||||
* Validate option value, when we can do so without any context.
|
* Validate option value, when we can do so without any context.
|
||||||
*/
|
*/
|
||||||
if (strcmp(def->defname, "use_remote_explain") == 0)
|
if (strcmp(def->defname, "use_remote_estimate") == 0)
|
||||||
{
|
{
|
||||||
/* use_remote_explain accepts only boolean values */
|
/* use_remote_estimate accepts only boolean values */
|
||||||
(void) defGetBoolean(def);
|
(void) defGetBoolean(def);
|
||||||
}
|
}
|
||||||
else if (strcmp(def->defname, "fdw_startup_cost") == 0 ||
|
else if (strcmp(def->defname, "fdw_startup_cost") == 0 ||
|
||||||
@ -145,9 +145,9 @@ InitPgFdwOptions(void)
|
|||||||
{"schema_name", ForeignTableRelationId, false},
|
{"schema_name", ForeignTableRelationId, false},
|
||||||
{"table_name", ForeignTableRelationId, false},
|
{"table_name", ForeignTableRelationId, false},
|
||||||
{"column_name", AttributeRelationId, false},
|
{"column_name", AttributeRelationId, false},
|
||||||
/* use_remote_explain is available on both server and table */
|
/* use_remote_estimate is available on both server and table */
|
||||||
{"use_remote_explain", ForeignServerRelationId, false},
|
{"use_remote_estimate", ForeignServerRelationId, false},
|
||||||
{"use_remote_explain", ForeignTableRelationId, false},
|
{"use_remote_estimate", ForeignTableRelationId, false},
|
||||||
/* cost factors */
|
/* cost factors */
|
||||||
{"fdw_startup_cost", ForeignServerRelationId, false},
|
{"fdw_startup_cost", ForeignServerRelationId, false},
|
||||||
{"fdw_tuple_cost", ForeignServerRelationId, false},
|
{"fdw_tuple_cost", ForeignServerRelationId, false},
|
||||||
|
@ -248,7 +248,7 @@ postgresGetForeignRelSize(PlannerInfo *root,
|
|||||||
RelOptInfo *baserel,
|
RelOptInfo *baserel,
|
||||||
Oid foreigntableid)
|
Oid foreigntableid)
|
||||||
{
|
{
|
||||||
bool use_remote_explain = false;
|
bool use_remote_estimate = false;
|
||||||
ListCell *lc;
|
ListCell *lc;
|
||||||
PgFdwRelationInfo *fpinfo;
|
PgFdwRelationInfo *fpinfo;
|
||||||
StringInfo sql;
|
StringInfo sql;
|
||||||
@ -285,9 +285,9 @@ postgresGetForeignRelSize(PlannerInfo *root,
|
|||||||
{
|
{
|
||||||
DefElem *def = (DefElem *) lfirst(lc);
|
DefElem *def = (DefElem *) lfirst(lc);
|
||||||
|
|
||||||
if (strcmp(def->defname, "use_remote_explain") == 0)
|
if (strcmp(def->defname, "use_remote_estimate") == 0)
|
||||||
{
|
{
|
||||||
use_remote_explain = defGetBoolean(def);
|
use_remote_estimate = defGetBoolean(def);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,9 +295,9 @@ postgresGetForeignRelSize(PlannerInfo *root,
|
|||||||
{
|
{
|
||||||
DefElem *def = (DefElem *) lfirst(lc);
|
DefElem *def = (DefElem *) lfirst(lc);
|
||||||
|
|
||||||
if (strcmp(def->defname, "use_remote_explain") == 0)
|
if (strcmp(def->defname, "use_remote_estimate") == 0)
|
||||||
{
|
{
|
||||||
use_remote_explain = defGetBoolean(def);
|
use_remote_estimate = defGetBoolean(def);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,12 +315,12 @@ postgresGetForeignRelSize(PlannerInfo *root,
|
|||||||
appendWhereClause(sql, true, remote_conds, root);
|
appendWhereClause(sql, true, remote_conds, root);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the table or the server is configured to use remote EXPLAIN, connect
|
* If the table or the server is configured to use remote estimates,
|
||||||
* to the foreign server and execute EXPLAIN with the quals that don't
|
* connect to the foreign server and execute EXPLAIN with the quals that
|
||||||
* contain any Param nodes. Otherwise, estimate rows using whatever
|
* don't contain any Param nodes. Otherwise, estimate rows using whatever
|
||||||
* statistics we have locally, in a way similar to ordinary tables.
|
* statistics we have locally, in a way similar to ordinary tables.
|
||||||
*/
|
*/
|
||||||
if (use_remote_explain)
|
if (use_remote_estimate)
|
||||||
{
|
{
|
||||||
RangeTblEntry *rte;
|
RangeTblEntry *rte;
|
||||||
Oid userid;
|
Oid userid;
|
||||||
|
@ -87,7 +87,7 @@ ALTER FOREIGN TABLE ft2 DROP COLUMN c0;
|
|||||||
-- requiressl, krbsrvname and gsslib are omitted because they depend on
|
-- requiressl, krbsrvname and gsslib are omitted because they depend on
|
||||||
-- configure options
|
-- configure options
|
||||||
ALTER SERVER testserver1 OPTIONS (
|
ALTER SERVER testserver1 OPTIONS (
|
||||||
use_remote_explain 'false',
|
use_remote_estimate 'false',
|
||||||
fdw_startup_cost '123.456',
|
fdw_startup_cost '123.456',
|
||||||
fdw_tuple_cost '0.123',
|
fdw_tuple_cost '0.123',
|
||||||
service 'value',
|
service 'value',
|
||||||
@ -124,9 +124,9 @@ ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
|
|||||||
|
|
||||||
-- Now we should be able to run ANALYZE.
|
-- Now we should be able to run ANALYZE.
|
||||||
-- To exercise multiple code paths, we use local stats on ft1
|
-- To exercise multiple code paths, we use local stats on ft1
|
||||||
-- and remote_explain mode on ft2.
|
-- and remote-estimate mode on ft2.
|
||||||
ANALYZE ft1;
|
ANALYZE ft1;
|
||||||
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_explain 'true');
|
ALTER FOREIGN TABLE ft2 OPTIONS (use_remote_estimate 'true');
|
||||||
|
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- simple queries
|
-- simple queries
|
||||||
|
Loading…
x
Reference in New Issue
Block a user