开发者

benefit of calling mysql_close() [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicates:

using mysql_close()

close mysql connection important?

What are the benefits of closing the connection using mysql_close() as the las开发者_运维问答t line of your script compared to letting php close it for you?


None if you have it as the last line of the script.

You can improve performance by closing as soon as you are done so the handle is available for other processes to use.

This implies you are doing some other stuff after you are done with the db.


None, using it before the end of script can free up one mysql connection and probably little Ram on php server.

But reopening connections to mysql is slow, so imho you'd better let php call it at end of execution, or use persistent connections.

Generally php scripts are run for milliseconds, even with good traffic hits, getting a high number (I mean 100+ at least) connections on mysql is rare. And again if this happens, use persistent connections.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜