Re: Postgres connection

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Joe Nilson Zegarra Galvez <nzegarra(at)kolareal(dot)net>
Cc: LISTA PGSQL-PHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: Postgres connection
Date: 2003-08-19 16:24:28
Message-ID: Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-php by date

  From Date Subject
Next Message scott.marlowe 2003-08-19 16:29:15 Re: Update problem
Previous Message Bruno Wolff III 2003-08-19 16:03:42 Re: Authentication Failure with pg_pconnect