|
Posted by Ivαn Sαnchez Ortega on 01/18/06 20:55
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
sam.s.kong@gmail.com wrote:
[...]
> If I just let each page loop each record, some pages might forget
> releasing db resources.
And? In PHP, if you let a file descriptor open, ther garbage collector will
gracefully close it when the script ends or gets killed for whatever
reason. If you let any other resource open (say, a database connection), it
will be gracefully closed when the program ends, whenever the developer
explicitly closes it or not.
> And I feel uncomfortable with the idea that db is opened at the top of
> a page and closed somewhere else far from the top.
In most cases, the DB connection is opened the first time a user hits a
page, and is not closed until some time after the user has hit a page.
Persistent connections save a lot of overhead, and are a lot preferable
than opening a DB conn, querying it, and closing it several times. A lot.
- --
- ----------------------------------
IvΓ‘n SΓ‘nchez Ortega -i-punto-sanchez--arroba-mirame-punto-net
http://acm.asoc.fi.upm.es/~mr/
Proudly running Debian Linux with 2.6.12-1-686 kernel, KDE3.5.0, and PHP
5.1.1-1 generating this signature.
Uptime: 19:51:59 up 8 min, 1 user, load average: 0.59, 1.04, 0.64
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFDzo8j3jcQ2mg3Pc8RAq/VAJ9MGLTzxgAhd3LX38lOsduRbaL3YACcDQ+a
C0J+ttOUT2zpQmGILWfIyX4=
=bxAi
-----END PGP SIGNATURE-----
[Back to original message]
|