Postgresql - extension - auto_explain

auto_explain module 提供了在不需要手动执行explain时,自动记录慢SQL的功能。
针对跟踪 优化SQL非常有帮助。

加载方式:

  1. 在postgresql.conf中配置(需要重启)
shared_preload_libraries = 'auto_explain'
  1. 在会话中开启(必须是superuser)
LOAD 'auto_explain';

参数配置:

auto_explain.log_min_duration (integer): 记录的最短执行时间,milliseconds
auto_explain.log_analyze (boolean): explain 是否输出为 explain analyze
auto_explain.log_buffers (boolean): explain 中是否记录buffers
auto_explain.log_timing (boolean): explain 中是否记录timing
auto_explain.log_triggers (boolean): trigger执行时间是否包含在内
auto_explain.log_verbose (boolean): explain 中是否记录verbose
auto_explain.log_settings (boolean): 更该信息是否记录。
auto_explain.log_format (enum): 记录格式 (text, xml, json, and yaml)
auto_explain.log_level (enum): 日志记录级别(DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, INFO, NOTICE, WARNING, and LOG)
auto_explain.log_nested_statements (boolean): 是否将嵌套语句(在函数内部执行的语句)视为记录日志。 禁用时,仅记录顶级查询计划。
auto_explain.sample_rate (real): 是否仅解释每个会话中的一部分语句。 默认值为1,表示解释所有查询。 如果是嵌套语句,将全部解释或不解释。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值