当 PostgreSQL 进程“在事务中空闲”时,这意味着什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/51019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does it mean when a PostgreSQL process is "idle in transaction"?
提问by Readonly
What does it mean when a PostgreSQLprocess is "idle in transaction"?
当PostgreSQL进程“在事务中空闲”时,这意味着什么?
On a server that I'm looking at, the output of "ps ax | grep postgres" I see 9 PostgreSQL processes that look like the following:
在我正在查看的服务器上,“ps ax | grep postgres”的输出我看到 9 个 PostgreSQL 进程,如下所示:
postgres: user db 127.0.0.1(55658) idle in transaction
Does this mean that some of the processes are hung, waiting for a transaction to be committed? Any pointers to relevant documentation are appreciated.
这是否意味着某些进程被挂起,等待事务提交?任何指向相关文档的指针表示赞赏。
采纳答案by Anonymoose
The PostgreSQL manualindicates that this means the transaction is open (inside BEGIN) and idle. It's most likely a user connected using the monitor who is thinking or typing. I have plenty of those on my system, too.
的PostgreSQL的手动指示此装置的交易是打开的(内部BEGIN)和空闲。很可能是使用显示器连接的用户正在思考或打字。我的系统上也有很多。
If you're using Slony for replication, however, the Slony-I FAQsuggests idle in transaction
may mean that the network connection was terminated abruptly. Check out the discussion in that FAQ for more details.
但是,如果您使用 Slony 进行复制,则Slony-I 常见问题解答建议idle in transaction
可能意味着网络连接突然终止。有关更多详细信息,请查看该常见问题解答中的讨论。
回答by Arthur Thomas
As mentioned here: Re: BUG #4243: Idle in transactionit is probably best to check your pg_locks table to see what is being locked and that might give you a better clue where the problem lies.
如此处所述:Re:BUG #4243:事务空闲最好检查您的 pg_locks 表以查看被锁定的内容,这可能会给您更好的线索问题所在。