Re: database connections
From: NSpam (NoSpam_at_NoSpam.garbage.rubbish)
Date: 03/02/05
- Next message: Personne: "Secure Script PHP"
- Previous message: Tim: "Re: database connections"
- In reply to: Tim: "Re: database connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 02 Mar 2005 16:02:04 GMT
Tim wrote:
> With a pconnect mysql holds a session so that you are not reconnecting
> each time. This works good if you are only connecting to one
> database.
>
> Warning:
> There are time when pulling information from two different databases
> within the same script where mysql will use the same session and try to
> pull them all from one table.
>
>
Hi Tim,
Interesting.
Do you know of a decent source of information regarding MySQL database
handles and sessions, particularly with regard to persistent
connections. I'm passing database handles around in sessions and see a
perceptable performance increase, in that i'm hacking existing code from:-
(pseudo code)
{
// existing inherited code
// brute force always get new connection
connect to mysql database
select database
use new handle to database
}
to
{
if (! isset($_SESSION['dbHandle'])) {
connect to mysql database
select database
store handle to handle to database
}
else {
use existing database handle
}
}
As I say its perceptably quicker, 'cos I assume the database connection
is persisting. I'm just curious to know the nuts and bolts - any pointers ?
Cheers
- Next message: Personne: "Secure Script PHP"
- Previous message: Tim: "Re: database connections"
- In reply to: Tim: "Re: database connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|