我有兴趣让我的本地postgres服务器配置与生产配置匹配。给定psql连接,是否可以运行一些查询并提取相关的性能选项?或者,如果这是不可能的,有没有人知道heroku的付费postgres计划的配置选项?
答案 0 :(得分:6)
这将显示服务器的所有设置。
SELECT current_setting(name), * FROM pg_catalog.pg_settings
然后你可以查看postgresql.conf以查看手动设置的内容。
如果您对postgresql.conf没有任何访问权限,请在其他服务器上使用上述查询,看看有什么不同:)
答案 1 :(得分:1)
只要您有权读取远程配置文件(在紧要关头更改分隔符),这应该有效。
create table conf(
line text
);
do $$
begin
execute
format(
'copy conf from ''%s'' delimiter ''|''',
current_setting('config_file'));
end $$;
select * from conf;
两个可能有用的提示。
-- skip empty and commented lines:
select line from conf
where line != '' and ltrim(line, e' \t') not like '#%';
-- copy conf to file:
copy (select replace(line, e'\t', ' ') from conf) to 'c:/data/postgres.conf';