PostgreSQL 9。3日志慢查询 [英] postgresql 9.3 log slow queries

查看:203
本文介绍了PostgreSQL 9。3日志慢查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Rails应用程序与Postgres 9.3数据库一起使用,并进行了一些性能修复。我想知道如何找出日志文件中最慢的查询。假设查询耗时超过30毫秒。

I am using Rails application with Postgres 9.3 database and doing some performance fixes. I would like to know how to find out slowest queries in log files. let say queries taking more then 30ms.

推荐答案

在postgresql.conf中,您应该取消注释行

In postgresql.conf you should uncomment line

#log_min_duration_statement = -1

将其值更改为30。这样将记录30ms以上的查询

and change its value to 30. This way queries longer than 30ms will be logged

这篇关于PostgreSQL 9。3日志慢查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆