是否需要mysql_close和pg_close? [英] Are mysql_close and pg_close required?

查看:89
本文介绍了是否需要mysql_close和pg_close?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

使用mysql_close()

是否需要mysql_close和pg_close?

Are mysql_close and pg_close required ?

在某些脚本中没有...为什么?

In some script there aren't... why ?

如果我不使用它会发生什么?

What happen if I don't use its ?

推荐答案

如果不调用它,则与数据库的套接字连接在等待状态下保持打开状态约30秒。

If you don't call it, the socket connection to the database remains open for ~30 seconds in a wait state.

如果您有很多人,并且您无法以某种方式设法重用这些僵尸连接,则数据库可能因用户错误而爆炸。

If you get lots and lots of people and you don't somehow manage to reuse these zombie connections, your database might explode with a too many users error.

因此,回答您的问题:语法上不需要,但是不包含它们是非常差的做法。

So in answer to your question: syntactically not required but it's very poor practice not to include them.

这篇关于是否需要mysql_close和pg_close?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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