【问题标题】:Unable to set fdw_startup_cost for postgres_fdw server无法为 postgres_fdw 服务器设置 fdw_startup_cost
【发布时间】:2021-10-29 12:08:21
【问题描述】:

我想更改现有 postgres_fdw 服务器的选项 fdw_startup_cost 的默认值,但收到一条错误消息,指出未找到选项 fdw_startup_cost,即使它是根据文档 (https://www.postgresql.org/docs/12/postgres-fdw.html) 的选项.

我使用的是 PostgreSQL 12.8 版本,用于设置服务器的代码如下:

CREATE EXTENSION postgres_fdw;

CREATE SERVER my_server_name
  FOREIGN DATA WRAPPER postgres_fdw
  OPTIONS (host 'myhost.whatever.com', dbname 'my_database_name', fetch_size '50000', use_remote_estimate 'true');

我用来更改设置的命令是:

ALTER SERVER prd_rtl_fdw OPTIONS (SET fdw_startup_cost '1000000000000000');

错误信息是:

An error occurred when executing the SQL command:
ALTER SERVER prd_rtl_fdw OPTIONS (SET fdw_startup_cost '1000000000000000')

ERROR: option "fdw_startup_cost" not found
1 statement failed.

如果我创建一个新服务器,我可以使用这个选项(并且应用成功):

CREATE SERVER my_new_server_name
  FOREIGN DATA WRAPPER postgres_fdw
  OPTIONS (host 'myhost.whatever.com', dbname 'my_database_name', 
  fetch_size '50000', use_remote_estimate 'true', fdw_startup_cost '1000000000000000');

但不幸的是,出于运营原因,创建新服务器并不是一个真正的选择。

任何帮助将不胜感激!

【问题讨论】:

    标签: postgresql postgres-fdw


    【解决方案1】:

    如果选项已经设置并且您想要更改值,那么您的陈述将是正确的。但是由于还没有设置选项,所以需要使用

    ALTER SERVER prd_rtl_fdw OPTIONS (ADD fdw_startup_cost '1000000000000000');
    

    【讨论】:

    • 太棒了 - 这真是一种享受。谢谢劳伦兹!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-25
    • 2014-03-14
    相关资源
    最近更新 更多