gpt4 book ai didi

postgresql - 日志记录 = Ubuntu 16.04 上 PostgreSQL 9.5 的所有问题

转载 作者:行者123 更新时间:2023-11-29 13:21:09 25 4
gpt4 key购买 nike

所以我知道 ALL 会给我 SELECTS,这是我想为我的应用程序监视的内容,但是,POSTGRES 守护进程正在针对数据库运行它自己的选择,并且正在记录它......

有谁知道如何避免这种情况,因为我的日志很快就会被填满

LOG:  statement: SELECT
(SELECT sum(xact_commit) + sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Transactions",
(SELECT sum(xact_commit) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Commits",
(SELECT sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Rollbacks"
2017-01-09 23:53:36 UTC [14264-16] evtofadmin@evtof LOG: statement: SELECT
(SELECT sum(xact_commit) + sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Transactions",
(SELECT sum(xact_commit) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Commits",
(SELECT sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Rollbacks"
2017-01-09 23:53:37 UTC [14264-17] evtofadmin@evtof LOG: statement: SELECT
(SELECT sum(xact_commit) + sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Transactions",
(SELECT sum(xact_commit) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Commits",
(SELECT sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Rollbacks"
2017-01-09 23:53:38 UTC [14264-18] evtofadmin@evtof LOG: statement: SELECT
(SELECT sum(xact_commit) + sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Transactions",
(SELECT sum(xact_commit) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Commits",
(SELECT sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Rollbacks"
2017-01-09 23:53:39 UTC [14264-19] evtofadmin@evtof LOG: statement: SELECT
(SELECT sum(xact_commit) + sum(xact_rollback) FROM pg_stat_database WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16384)) AS "Transactions", ....
...
...

最佳答案

只为应用开启日志,

SQL:

ALTER USERyour_app_usernameSET log_statement='ALL';

关于postgresql - 日志记录 = Ubuntu 16.04 上 PostgreSQL 9.5 的所有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41559053/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com