SQL,PHP - 关闭正在休眠的连接 [英] SQL, PHP - Close a sleeping connection

查看:165
本文介绍了SQL,PHP - 关闭正在休眠的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有人都有美好的一天。我有一个小问题:

Good day to all. I have a little problem:

如何关闭睡眠连接到数据库?

How do I close the sleeping connections to a database?

当我发出查询时,执行查询,然后连接保持睡眠模式2-3秒。问题是我生成的查询比关闭时要快。

When I issue a query the query is executed then the connection remains on sleep mode for 2-3 seconds. The problem is that I generate queries faster than they are closed.

有没有办法在进入睡眠模式之前强制关闭连接?或任何解决方法。

Is there a way to force a connection to close before entering in the sleep mode? Or any workaround.

感谢您的帮助。

注意:连接不是永久性的,但只是减慢...
注2 - 对于mysql_close():该命令是在查询结束时发出的。仍然查询在关闭前进入睡眠模式。我在分钟内附加一个打印屏幕。

Note: The connections are not permanent, they close, but just to slow... Note 2 - for the mysql_close(): The command is issued at the end of the query. Still the query goes into sleep mode before close. I attach a print screen in a min.

注意睡眠连接...他们将在1-3秒...关闭,但我生成另一个查询更快。我需要跳过睡眠浪费的时间。

Notice the sleeping connections... they will be closed in 1-3 secs... but I generate another queries faster. I need to skip the sleep wasted time.

推荐答案

是否使用mysql_pconnect()?

Are you using mysql_pconnect() ? If not, this should not happen if you properly close every connection made to your database.

编辑:类似问题?

这篇关于SQL,PHP - 关闭正在休眠的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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