Re: Why persistent connection ?
| From: | eric ³ | Date: | Thu, 06 Jul 2000 14:03:02 +0000 |
| Subject: | Re: Why persistent connection ? | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-897@lists.php.net to get a copy of this message | ||
If you use persistent connections, do you have to specify pg_pconnect("name
of DB"); on each page of your script? or say opening the connection once on
the first page ... then will each query be 'previously' connected to the db
so as to perform it's operation?
eric³
:':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':':
:.: web developer . pixel pusher
:.: http://www.GoGraphics.com
:.: http://users.drak.net/zenlab
:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:
:.: www.ScreamDesign.com
:.: the learning source for the next generation.
:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:
----- Original Message -----
From: "Chris Adams" <chris@digitaria.com>
To: "php-db" <php-db@lists.php.net>
Sent: Wednesday, July 05, 2000 9:55 PM
Subject: Re: [PHP-DB] Why persistent connection ?
> > What's the advantage/utility/reason to use persistent
> > connections instead of simple connections (in
>
> If you have PHP running as a CGI or are not using persistent connections,
> the life of your script looks like this:
>
> - PHP starts script executing
> - script connects to database
> - script does little bit of work user actually cares about
> - script disconnects from database
> - PHP finishes execution
>
> If you use persistent connections (which only work when PHP is a module),
> it's like this:
>
> - PHP starts script executing
> - script does little bit of work user actually cares about
> - PHP finishes execution
>
> This can be a huge win if connecting to the database is a time consuming
or
> resource intensive operation. Depending on your script and configuration
> details, this could require as much time as the rest of the script!
>
> The reason for this is simple - most databases were designed around the
> model of an application, where a user logs in when they get to work, runs
a
> ton of queries over the course of the day and logs out at the end of the
> day. In this case, it makes a lot more sense to focus on making each query
> fast and not worrying about the performance of establishing the
connection.
>
> Of course, with the web the performance model is completely different.
> Without persistent connections, it's something like connect, run a couple
> queries, disconnect, repeated many times. Persistent connections allow the
> scripting engine to keep database connections open across many requests so
> that your script won't need to connect to the database each time it's
> called, which makes your script behave in a fashion more like what most
> databases were designed to handle.
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>