pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Joe Nilson Zegarra Galvez <nzegarra@kolareal.net>
Cc: LISTA PGSQL-PHP <pgsql-php@postgresql.org>
Subject: Re: Postgres connection
Date: Tue, 19 Aug 2003 10:24:28 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com> (raw)
In-Reply-To: <1061298784.2525.2.camel@dune.dcielo.com>

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.




view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: scott.marlowe@ihs.com, nzegarra@kolareal.net
  Subject: Re: Postgres connection
  In-Reply-To: <Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com>
  References: <1061298784.2525.2.camel@dune.dcielo.com> <Pine.LNX.4.33.0308191019120.9295-100000@css120.ihs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox