PG数据库在手动收集表统计信息的时候想要增加统计信息的准确度,以下哪些命令可以实现? BD
A
alter table tab_name alter column col_name set (n_distinct_inherited=xxx);
B
alter table tab_name alter column col_name set statistics xxx;
C
alter table tab_name alter column col_name set (n_distinct=xxx);
D
set default_statistics_target to xxx;
在PG中对于大表,使用analyze手动收集统计信息只读取表的部分内容做一个随机抽样,不读取表的所有内容。统计信息只是近似的结果。为了调整所收集的统计信息的准确度,可以增大随机抽样比例,可通过参数default_statistics_target来实现,这个参数可以在session级别设置,可以在列级别设置。
set default_statistics_target to xxx;
alter table tab_name alter column col_name set statistics xxx;
该参数告诉 PostgreSQL 应该抽样多少数据来填充存储元数据的表。默认值为100,PostgreSQL 会读取 default_statistics_target * 300 个页面来完成行的随机抽样。
PostgreSQL默认初始化数据库后,模板数据库template0和template1包含的内容是一致的。A
A
正确
B
错误
template0, template1 库,开始时这两个库的内容是一样的,
但这两个库有啥异同呢?任何时候都不要对template0模板数据库进行任何修改,因为这是原始的干净模板,如果其它模板数据库被搞坏了,基于这个数据库做一个副本就可以了。
如果希望定制自己的模板数据库,那么请基于template1进行修改,或者自己另外创建一个模板数据库再修改。对基于template1或你自建的模板数据库创建的数据库来说,你不能修改其字符集编码和排序规则。template0可以。
postgresql 13中pg_rewind 增加了哪几个选项参数?BCD
A
-N, --no-sync
B
--no-ensure-shutdown
C
-c, --restore-target-wal
D
-R, --write-recovery-conf
pg13命令pg_rewind新增参数:
-c, --restore-target-wal use restore_command in target configuration to retrieve WAL files from archives
--no-ensure-shutdown do not automatically fix unclean shutdown
-R, --write-recovery-conf write configuration for replication(requires --source-server)
https://www.postgresql.org/docs/13/app-pgrewind.html
pg12命令pg_rewind新增参数:
-N, --no-sync do not wait for changes to be written safely to disk
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




