Re: passing resource id's through functions - Mailing list pgsql-php

From Chadwick Rolfs
Subject Re: passing resource id's through functions
Date
Msg-id Pine.SOL.3.96.1020114170101.11421C-100000@shell.gis.net
Whole thread Raw
In response to Re: passing resource id's through functions  (Andrew McMillan <andrew@catalyst.net.nz>)
Responses Re: passing resource id's through functions  (Andrew McMillan <andrew@catalyst.net.nz>)
List pgsql-php
Yes, that's it.  Using the $GLOBALS array works just fine, and I don't
have a bunch of pconnections cluttering up the process list, apache, or
postgresql.  I don't think persistent connections are meant to be _faster_
as much as they are meant for cutting down on redundant connections.
Unfortunately, I'm getting a bunch of redundant connections when pconnect
is used.  Since I don't administer the server, and the ones who do are too
busy to experement, I'll have to deal with it.  I'd like to know if
anyone else is having the same problem with pconnect:

pg_pconnect is in ONE file referred to by all of my other files.  So there
is only one connect string.  It can't change unless I edit the connection
file between invocations (let's just say it's STATIC)

when I go to pg_exec with the pg_pconnect resource, I get a seperate
connection for each exec!  This is clearly not supposed to be the case
acoording to http://www.php.net/manual/en/function.pg-pconnect.php

setting apache to only accept a certain amount of links is a good work
around, but what about everyone else?  Won't my connections just get
kicked off if other pconnections take over?  when I look at the postgres
processes, I should see _ONE_ persistent connection, not nine

The max conncection set is 64, so that won't be a problem, except that
each persistent connection takes a little bit of memory (2.5%), and enough
of them will actually slow the sever down.

Thanks for the great suggestion on using php's global namespace!

Regards,

On 12 Jan 2002, Andrew McMillan wrote:

> On Sat, 2002-01-12 at 04:44, Chadwick Rolfs wrote:
> > I seem to have figured out that pg_connect returns a resource ID that will
> > not pass into another function, and that pg_pconnect does.  I'm not too
> >
> > Any help would be appreciated, and helpful :)
>
> It might be that I don't see any difference because connecting to the
> database(s) is something I do globally, rather than inside a function,
> or through instantiating an object.

Chadwick Rolfs - cmr@gis.net
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*--


pgsql-php by date:

Previous
From: "Brent R. Matzelle"
Date:
Subject: Re: passing resource id's through functions
Next
From: Andrew McMillan
Date:
Subject: Re: passing resource id's through functions