[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP3] MySQL questions
From:       Cary Collett <caryc () shore ! net>
Date:       1998-05-29 18:08:05
[Download RAW message or body]

Egon Schmid (eschmid@delos.stuttgart.netsurf.de) said:

> 
> 
> On Fri, 29 May 1998, Alexander Lohse wrote:
> 
> > <fontfamily><param>Geneva</param>Hi,
> > 
> > 
> > I started out learing mSQL as an easy-to-learn DB, but now I found out
> > that concerning stability it would be better to go with MySQL. (When I
> > listen to this Mailing-List almost everybody uses MySQL!)
> > 
> > Is it really that much better?
> 
> Yes

A very strong yes. Especially if you plan to use any sort of complex
WHERE clauses. mSQL is dog slow with JOINs. Plus mSQL is a very
spare on features while MySQL has a very rich feature set.

> 
> > But the main question I wanted to ask is:
> > 
> > I studied to docs, and in the MySQL section I keep stumbling about a
> > mystical thing to me:
> > 
> > The link_identifier.
> 
> Eine Datenbankverbindung. With mysql_[p]connect() you get that link
> identifier for an MySQL server on a host. 
> 
> > Can anyone give a description what it is, what it does, where it comes
> > from and last but not least where I can find out which one I have to
> > use!
>  
> > Or do I not need one when I only use the localhost?
> 
> You need one and only one. You cannot get a second to the same host.

Not true. A link identifier has a set of permissions based on the username
is was created with. If you need to access a db in a way that the username
associated with the current link can't, you need to make a new link. Thus
you could have as many links as you have host/username combinations. (Or,
in Alexander's case, as many usernames as he has on the localhost's mysql.)

The way mysql_pconnect works is that by first searching for a current link
with the same parameters (username, password, host), if it finds one, it 
uses it, if it doesn't it creates a new link. This is most useful when
running mysql as a module in the web server. In this situation, (I'm 
thinking Apache here, it's what I use), each Apache child will service a
number of requests before being killed. So, once you open a link within
that particular child, other requests that that child services which use
the same link parameters avoid the overhead of establishing the connection
to MySQL.

Of course PHP manages all this all you have to do is make a call to 
mysql_pconnect() to either establish the new link or use an existing one.


I think there are plans for resource sharing between Apache children in
future releases of PHP. But I'm not sure. I've also heard that Apache
2.0 will be non-forking which would make eliminate the need for said
resource sharing I suppose.



Cary

-- 
Cary Collett                                           cary@ratatosk.org

To me, boxing is like ballet, except there's no dancing, no choreography
and the dancers hit eachother.

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe@lists.php.net
To subscribe to the digest list:  php3-digest-subscribe@lists.php.net
For help: php3-help@lists.php.net  Archive: http://www.tryc.on.ca/php3.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic