Re: Postgres connection - Mailing list pgsql-php

From scott.marlowe
Subject Re: Postgres connection
Date
Msg-id Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com
Whole thread Raw
In response to Postgres connection  (Joe Nilson Zegarra Galvez <nzegarra@kolareal.net>)
List pgsql-php
On 19 Aug 2003, Joe Nilson Zegarra Galvez wrote:

> Hi all, i have a question, i have a php file with all my class to
> connect into a postgresql db and i'm using the pg_connect in this form:
>
> pg_connect("192.168.1.X","","","",$dbase);

That's the old style connect method, you should update to the single
argument versions that lookgs like this:

pg_connect("dbname=dbname host=host user=user port=port");

But that's not the problem, just advice.  Someday the 5 argument version
might slip off the face of PHP.

> but when i have 8 or 10 users inserting data, the db response is very
> slow, is problem in the pg_connect?, all ppl use the same file_class.php
> to connect to the db.

the problem is probably in your schema.  Do you have lots of fk
constraints on the tables you're inserting into?  Are you wrapping all
your inserts / updates / deletes into a single transaction?  (you should).

How many inserts per second are these clients doing? (or trying to do :)

> The Server is a Compaq Proliant with two Xeon 2.20Ghz Processors, 1Gb
> Memory, 20Gb SCSI HD, 1Gb Ethernet and Redhat Linux 8.0 with apache
> 2.0.47,
> php 4.2.2 and PostgreSQL 7.2.2

Always run the latest version, either 7.2.4 or 7.3.4.  7.3.4 is a bit
faster at fks than 7.2.4 so may be worth the upgrade if that's the issue.

> How can i do better the response of the server?

It may well be a fk mismatch issue or something like it.  examine your
table structure to make sure you aren't keying a varchar against an int8
or something like that.

also, look at tuning your default postgresql.conf file, it's pretty weak
out of the box on 7.2.x.


pgsql-php by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Securing PHP scripts
Next
From: "scott.marlowe"
Date:
Subject: Re: Update problem