Обсуждение: Postgres connection

Поиск
Список
Период
Сортировка

Postgres connection

От
Joe Nilson Zegarra Galvez
Дата:
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);

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 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

How can i do better the response of the server?

Thankx for your answers

Regards


Nilson


Re: Postgres connection

От
"scott.marlowe"
Дата:
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.


Re: Postgres connection

От
Martin Marques
Дата:
El Mar 19 Ago 2003 10:13, escribió:
> 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);

Change this to what the manual says:

http://www.php.net/manual/en/function.pg-connect.php

See that it passes only one argument.

> 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 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
>
> How can i do better the response of the server?

Depends on what your postgresql.conf file says.

Check these links:

http://www.varlena.com/GeneralBits/Tidbits/perf.html

http://www.varlena.com/GeneralBits/Tidbits/annotated_conf_e.html

Saludos... :-)

--
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------