简体   繁体   English

Amazon Postgres RDS pg_stat_statements未加载

[英]Amazon Postgres RDS pg_stat_statements not loaded

I configured my RDS Postgres 9.6.1 instance so, that the pg_stat_activity is loaded via 'shared_preload_libraries' parameter 我配置了我的RDS Postgres 9.6.1实例,以便通过'shared_preload_libraries'参数加载pg_stat_activity

shared_preload_libraries=pg_stat_statements,pg_hint_plan

The I rebooted my instance and then check if the pg_stat_statements can be loaded. 我重新启动了我的实例,然后检查是否可以加载pg_stat_statements。 But I get the error: 但我得到错误:

[55000] ERROR: pg_stat_statements must be loaded via shared_preload_libraries

The command 命令

SHOW shared_preload_libraries;

does not show the pg_stat_statements library. 不显示pg_stat_statements库。

And therefore the error above still remains. 因此上述错误仍然存​​在。

Does somebody else has got the same issue ? 其他人有同样的问题吗?

Thanks, Detlef 谢谢,Detlef

UPDATE UPDATE

I tried myself. 我试过自己。 Added to Parameters->shared_preload_libraries values: pg_stat_statements,pg_hint_plan . 添加到Parameters-> shared_preload_libraries值: pg_stat_statements,pg_hint_plan Clicked "save changes", agreed on "Apply Immediately". 点击“保存更改”,同意“立即申请”。 Indeed no effect. 确实没有效果。 When I check DB Parameter Group - it shows modified group, but pg_stat_statements unusable. 当我检查数据库参数组时 - 它显示已修改的组,但pg_stat_statements不可用。 So I think bad on JS and try aws cli : 所以我认为JS很糟糕并尝试使用aws cli

aws rds describe-db-instances --db-instance-identifier p5

it reveals that group was not indeed changed!: 它揭示了群体确实没有改变!:

"OptionGroupMemberships": [
    {
      "Status": "in-sync",
      "OptionGroupName": "default:postgres-9-5"
    }
  ],

So I did: 所以我做了:

aws rds modify-db-instance --db-parameter-group-name with-contrib --apply-immediately --db-instance-identifier p5
aws rds reboot-db-instance --db-instance-identifier p5
aws rds describe-db-instances --db-instance-identifier p5

And It was changed. 它改变了。 So I try to: 所以我试着:

mon=> create extension pg_stat_statements ;
CREATE EXTENSION
mon=> select count(*) from pg_stat_statements;
 count
-------
    26
(1 row)

Voila. 瞧。 Not sure if it was Chrome (Version 57.0.2987.133 (64-bit)) feature or JS failure, or me not getting intuitive clicking steps, but I failed to apply changes as well. 不确定它是Chrome(版本57.0.2987.133(64位))功能还是JS失败,或者我没有直观点击步骤,但我也没有应用更改。 Please try with aws cli to see if you success there. 请尝试使用aws cli ,看看你是否在那里取得了成功。

PREVIOUS String requires quotes I think. 上一篇 字符串我需要引用。 :

String: In general, enclose the value in single quotes, doubling any single quotes within the value. 字符串:通常,将值括在单引号中,使值中的任何单引号加倍。 Quotes can usually be omitted if the value is a simple number or identifier, however. 但是,如果值是简单的数字或标识符,则通常可以省略引号。

So maybe setting shared_preload_libraries this way will help: 因此,以这种方式设置shared_preload_libraries将有助于:

shared_preload_libraries = 'pg_stat_statements,pg_hint_plan'

https://www.postgresql.org/docs/current/static/runtime-config-client.html : https://www.postgresql.org/docs/current/static/runtime-config-client.html

shared_preload_libraries (string) shared_preload_libraries (string)

This variable specifies one or more shared libraries to be preloaded at server start. 此变量指定要在服务器启动时预加载的一个或多个共享库。 This parameter can only be set at server start. 此参数只能在服务器启动时设置。 If a specified library is not found, the server will fail to start. 如果找不到指定的库,则服务器将无法启动。

Ran into the same problem today. 今天遇到同样的问题。

Turns out I simply had to reboot the database (via CLI or web interface). 结果我只需要重启数据库 (通过CLI或Web界面)。

As mentioned on the AWS docs : 正如AWS文档中所述

When you change a static parameter and save the DB parameter group, the parameter change takes effect after you manually reboot the DB instance . 更改静态参数并保存数据库参数组时, 参数更改将在手动重新引导数据库实例后生效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM