Re: I don't close my databases

From: Andy Hassall (andy_at_andyh.co.uk)
Date: 01/23/04


Date: Fri, 23 Jan 2004 19:12:20 +0000

On Fri, 23 Jan 2004 10:09:45 GMT, wallycantrell@hotmail.com (wally canrell)
wrote:

>Yes it is true ... nowhere in my code do I close a database.
>
>This is based on instruction that followed this advice:
>
><quote>
>Using mysql_close() isn't usually necessary, as non-persistent open
>links are automatically closed at the end of the script's execution.
>See also freeing resources. </quote>
>
>http://www.zend.com/manual/function.mysql-close.php
>
>I am using a shared hosting environment and there is a lot ot talk
>about closing databases.
>
>So .. do I need to close my databases or not?

 No, you don't need to. The manual is correct, it's closed for you at the end
of the script.

 But it might be polite to do so if connections are limited, if you know that
you don't need the database connection past a certain point in the page.

 If your page takes a second to run, and you only need it for the first tenth
of a second, then freeing it up early makes it available to others.

-- 
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>


Relevant Pages

  • Re: Query performance dramatically different
    ... "Dusan Bolek" a écrit dans le ... > Teradata databases using Oracle OpenGateway( ... > execution plans (they are ... > Using explain plan I got two variants, ...
    (comp.databases.oracle.server)
  • Re: query performance help needed
    ... why I guessed that the execution plan is gone. ... executes this sp from 30 databases. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: preg_match_all Maximum execution time of 60 seconds error
    ... a web site or synchronising two databases. ... Well yeah, about a 1000 pages will almost certainly need more execution time, ...
    (comp.lang.php)