Re: Opening/closing a DB

From: Date: Thu, 15 Mar 2001 18:22:58 +0000
Subject: Re: Opening/closing a DB
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-44350@lists.php.net to get a copy of this message
With InterBase using persistent connections will save a lot of time. However, you need to be extra careful with how you manage transactions. InterBase uses a versioning engine for transaction management and you can easily screw up the system performance if you don't manage your transactions correctly. Make sure you use short quick transactions. Don't leave a transaction open, always make sure the transaction is committed or rolledback. Lingering transactions are probably the biggest performance problem you'll encounter with InterBase. Brett ""Daniel Grace"" <rubein@earthlink.net> wrote in message news:004101c0a992$80fa98c0$b4bc9a40@hades... > On Saturday, March 10, 2001 at 7:03 AM, Todd Cary <todd@aristesoftware.com> > wrote: > > > I have some questions about PHP and it's interaction with a DB (namely, > > Interbase). My client's application uses a DB extensively and I am not > > clear about opening and closing a DB - the price one pays. > > > > First, I notice that the approximate time to open a connection to my DB > > on my test system is 1 second with a "locate time" of another second. > > So, 50% of the time is opening the DB. > -- snip -- > > I haven't used Interbase, but if it's like most of PHP's database > interfaces, it isn't too critical to worry about closing the database > connection. PHP will do so automatically when your script ends. > > -- unsnip -- > > > > The next question envolves closing the DB and returning memory. > > > > ibase_free_result; > > ibase_close($dbh); > > > > What will happen if in my code I forget to do this in a place or two? > > Will the system eventually crash? > -- snip -- > > The Interbase extensions to PHP support persistent connections: > http://www.php.net/manual/en/function.ibase-pconnect.php (see > mysql_pconnect() as well for more general info on persistent connections). > With persistent connections, the overhead in connecting to the database > backend is minimized since the same connection can be shared across multiple > pages. This won't work with the CGI version of PHP however. > > - Daniel Grace <http://dewin.oldbattery.com/> > > "Space may be the final frontier but its made in a Hollywood basement." > - Red Hot Chili Peppers - Californication > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#44350) next »