Re: passing resource id's through functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



When I say I didn't have problems with pconnect; I meant I never had the
resource-id problem with pg_pconnect that you described in your initial
message.  I still have the resource-id problem when using pg_connect
(called via phplib), but I work around it for now by making my $dbc
variable global.  I would still prefer to see a resolution to the problem
as you initially described it.

I had the "too many connections" problem with pconnect under apache as my
number of databases increased.  Each apache child maintains it's own list
of permanent connections (also see below).  I have a database for each
domain being hosted on my server, so number of databases multipled by
number of children finally got up to the max number of connections in
postgres/apache.  At this point, I changed the phplib code to use
pg_connect instead of pg_pconnect.

pconnect will save you time making connection to psql, that much is true
and stated in all kinds of docs.  What they don't tell you is that the
saving when pgsql is on the same box is marginal.  In a case where you have
a huge site and a single database on a separate database server, then
pconnect makes sense to save the connect time between the two boxes.  At
the other end of the scale is many databases on the same server as your web
server; in this case pg_connect makes more sense to reduce total number of
connections.  In between is the usual grey area.

What a minute...  When I said each apache child process keeps it's own list
of p-connections, I should also add that a new connection is created
whenever the database name or userid changes.  I tend to forget this part,
because I create a userid per database and all accesses from apache to a
database uses that userid.  In order words, I never have the situation
where a single database is accessable by two users.

Although there is no utility to 'delete' permanent connections, they will
go away when not used, I don't how how long exacly, but it was longer than
a hour and less than a day.

Frank

At 11:25 AM 1/11/02 -0500, Chadwick Rolfs wrote:
>On Fri, 11 Jan 2002, Frank Bax wrote:
>> I never had any problems with pg_pconnect either.  When I switched to
>
>Thanks for the tip!  I think we'll eventually get around to writing our
>own libs for php/postgresql, I'll check out PHPLIB DB for examples (or
>convince them to use it:))
>I've had problems with people making too many pconnections, and couldn't
>even psql into postgresql.  Apache needs to be reset at that point, and
>there doesn't seem to be any new function to kill pconnections....you've
>never had problems with that?
>
>Chadwick Rolfs - cmr@xxxxxxx
>Cleveland State University - Student
>Music Major - The Holden Arboretum Volunteer
>Computer Programmer - Student Employee
>--*I finally found powdered water;
>I just can't figure out what to add to it*--



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux