postgres中的很多SHOW TRANSACTION ISOLATION LEVEL查询

编程入门 行业动态 更新时间:2024-10-25 10:32:58
本文介绍了postgres中的很多SHOW TRANSACTION ISOLATION LEVEL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用Hibernate 4,PostgreSQL和C3P0。

I am using Hibernate 4, PostgreSQL and C3P0.

在我的Web应用程序中,一段时间后,我在数据库中收到多个 SHOW TRANSACTION ISOLATION LEVEL 查询,这是由于我服务器挂起。在我的代码中,我所有的连接均已正确关闭。

In my web application, after sometime I am getting multiple SHOW TRANSACTION ISOLATION LEVEL queries in database due to which my server gets hang. In my code all my connections are properly closed.

是由于连接泄漏引起的吗?

Is it due to a connection leak?

推荐答案

您还应该检查每个查询的状态,如果它是 idle 没问题。

You should also check the state of each query, if it's idle it's most likely nothing problematic.

pg_stat_activity 将显示每个打开的连接所执行的最后一个查询。 c3p0使用 SHOW事务隔离级别保持连接打开(正常行为和预期行为)。

pg_stat_activity will show last query that was executed by each open connection. And c3p0 uses SHOW TRANSACTION ISOLATION LEVEL to keep the connection open (normal and expected behavior).

这是什么发生:

  • 连接已打开
  • SHOW事务隔离级别
  • 连接池将定期(例如每10分钟)发送此查询以保持连接打开。
  • 这些查询显示在 pg_stat_activity 中,因为在某些情况下,这些查询是通过给定连接执行的最后一个查询。另外,由于此连接未处于有效使用状态,它们将显示为 idle
  • Connection is opened
  • SHOW TRANSACTION ISOLATION LEVEL is executed to keep the connection open.
  • Connection pool will send this query periodically (for example every 10 minutes) to keep the connection open.
  • Those queries show up in pg_stat_activity because in some cases those were the last queries executed via given connection. Also they will show up as idle because this connection is not in active use
  • 更多推荐

    postgres中的很多SHOW TRANSACTION ISOLATION LEVEL查询

    本文发布于:2023-10-28 13:23:48,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1536757.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:SHOW   postgres   TRANSACTION   LEVEL   ISOLATION

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!