简体   繁体   English

查询执行时间日志,PostgreSQL?

[英]Query execution time log, PostgreSQL?

Objective: I have thousands of data, I want to know how to have a record of all the queries and the time it takes to complete each query.目标:我有成千上万的数据,我想知道如何记录所有查询以及完成每个查询所需的时间。

Any suggestions what I should investigate?有什么建议我应该调查吗? I've seen about pg_stat_activity.我已经看到了 pg_stat_activity。 I am fully available to nurture myself, I would appreciate any documentation, since I only have basic knowledge.我完全可以培养自己,我会很感激任何文档,因为我只有基本知识。

PD: Thanks.警察:谢谢。

There is a log_min_duration_statement setting in the postgresql.conf file that defines a minimum duration, after which the duration and statement will be logged. postgresql.conf 文件中有一个log_min_duration_statement设置,它定义了最短持续时间,之后将记录持续时间和语句。 If set to zero, all statements and durations are logged.如果设置为零,则记录所有语句和持续时间。

One should take care that using this setting does not consume too much disk space.应注意使用此设置不会占用太多磁盘空间。

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

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