From gmonsalvo@rentastucuman.gov.ar Tue Dec 17 22:53:44 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D6BC44768CF for ; Tue, 17 Dec 2002 17:53:44 -0500 (EST) Received: from ar16.toservers.com (host116.200.80.42.ifxnw.com.ar [200.80.42.116]) by postgresql.org (Postfix) with ESMTP id 5B75B4769A3 for ; Tue, 17 Dec 2002 17:52:18 -0500 (EST) Received: from CorreoMovil (localhost [127.0.0.1]) by ar16.toservers.com (8.11.6/8.11.4) with SMTP id gBHN3XF26865 for ; Tue, 17 Dec 2002 20:03:33 -0300 Message-Id: <200212172303.gBHN3XF26865@ar16.toservers.com> Received: from client 200.45.224.83 for UebiMiau (webmail client); Tue, 17 Dec 2002 20:03:33 -0300 Date: Tue, 17 Dec 2002 20:03:33 -0300 From: "Ing. Gabriel Monsalvo" To: Reply-To: "Ing. Gabriel Monsalvo" Subject: Slow Executing queries X-Priority: 3 X-Mailer: CorreoMovil 1.0 Content-Transfer-Encoding: 8bit X-MSMail-Priority: Medium Importance: Medium Content-Type: text/html; charset="iso-8859-1"; MIME-Version: 1.0 X-scanned: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/230 X-Sequence-Number: 6725 Tom:

We have a IBM NetServer i with 2.5 GB de Ram and RAID 5 with 137 GB, two
PIV Xeon at 1.6 GHZ... I mounted Linux in this server with
PostgreSQL 7.3, we start to deploy the database and we have a lot of
performance problems, i need help for tune up the server....i read the faqs,
a lots of documents about gets better performance but i don't obtain good
results...for example this table: OBLIGACION have 15 millions of records

Column | Type | Modifiers
----------+-----------------------+-----------
cuil | numeric(11,0) |
objeto | character varying(11) |
impuesto | numeric(3,0) |
concepto | numeric(3,0) |
tipobj | numeric(3,0) |
fecvtop | date |
fecvtod | date |
graba | date |
fecgen | date |
hora | character varying(4) |
operador | character varying(10) |
numoble | numeric(13,0) |
puesto | numeric(3,0) |
secsec | numeric(4,0) |
periodo | numeric(6,0) |
cuota | numeric(3,0) |
ctrlpago | numeric(3,0) |
ddjjd | numeric(3,0) |
tipopp | numeric(4,0) |
nroppago | numeric(8,0) |
marca | numeric(3,0) |
Indexes: numoble_oblig btree (numoble),
objeto_oblig btree (objeto),
periodo_oblig btree (periodo)

sapym=# explain select max(numoble) from obligacion where periodo=200100;
QUERY PLAN
----------------------------------------------------------------------------
-----------------------
Aggregate (cost=6983070.47..6983070.47 rows=1 width=16)
-> Index Scan using periodo_oblig on obligacion (cost=0.00..6978186.18
rows=1953717 width=16)
Index Cond: (periodo = 200100::numeric)
(3 rows)

>> there is a index for obligacion on periodo but this query takes over 2
minutes for finish.


sapym=# explain select count(*) from obligacion where periodo=200100;
QUERY PLAN
----------------------------------------------------------------------------
----------------------
Aggregate (cost=6983070.47..6983070.47 rows=1 width=0)
-> Index Scan using periodo_oblig on obligacion (cost=0.00..6978186.18
rows=1953717 width=0)
Index Cond: (periodo = 200100::numeric)
(3 rows)

can you help to solve the problem? i really want to use PostgreSQL in my
organization but if i can't solve this problem we must
migrate to ugly DB2 .

thanks in advance.

Gabriel Monsalvo







________________________________________________________________________

Este Mail Ha sido enviado por CorreoMovil - Su cuenta POP este donde este

From squid@maxiconsumo.com Wed Dec 18 14:28:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C730B475AA1 for ; Wed, 18 Dec 2002 09:28:36 -0500 (EST) Received: from maxint01.maxiconsumo (unknown [200.26.107.67]) by postgresql.org (Postfix) with ESMTP id 47AE9475925 for ; Wed, 18 Dec 2002 09:28:35 -0500 (EST) Received: from maxiconsumo.com (JMFERA [192.168.100.141]) by maxint01.maxiconsumo with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id Y5F7VBX1; Wed, 18 Dec 2002 11:31:01 -0300 Message-ID: <3E008688.2010508@maxiconsumo.com> Date: Wed, 18 Dec 2002 11:30:32 -0300 From: Administrador Squid User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: es-ar, es, en-us, en MIME-Version: 1.0 To: "Ing. Gabriel Monsalvo" Cc: pgsql-admin@postgresql.org Subject: Re: Slow Executing queries References: <200212172303.gBHN3XF26865@ar16.toservers.com> Content-Type: multipart/alternative; boundary="------------000207090203010300040407" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/235 X-Sequence-Number: 6730 --------------000207090203010300040407 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Gabriel: No soy un administrador de mucha experiencia, pero tambi=E9n sufr=ED mucho= s=20 problemas de rendimiento hasta que modifiqu=E9 dos par=E1metros en postgresql.conf y en el kernel. Los par=E1metros que cambie en postgresql.conf son "sort_mem", donde=20 debes poner cuantos kilobytes va a utilizar cada proceso cuando deba realizar el ordenamiento de una tabla (ojo que si pones 10=20 megabytes. en este par=E1metro son 10 megabytes. por cada proceso que est=E9 realizando un ordenamiento en ese momento), y el otro es=20 "shared_buffers", que es la cantidad de bloques de 8 kb. que se van a utilizar de memoria compartida, para subir las tablas completas a=20 memoria, por ejemplo. Este =FAltimo espacio se ocupa una =FAnica vez y lo utilizan todos los procesos que cree el postmaster. Mi (modesta) configuraci=F3n es: sort_mem =3D 1024 (un megabyte) shared_buffers =3D 2048 (16 megabytes) Seguramente tus n=FAmeros van a ser m=E1s grandes y quiz=E1 debas modifica= r=20 un par de par=E1metros del kernel v=EDa /etc/sysctl.conf y luego ejecutar sysctl. Los par=E1metros que hay que tocar son shmall y shmmax y los valores se=20 deben expresar en bytes. El valor que se debe poner debe ser igual o mayor (expresado en bytes por supuesto) que el de=20 shared_buffers. Quiz=E1 esto ya lo hayas probado, si no que sirva, te mando unos enlaces= =20 interesantes de donde saque esta informaci=F3n y otros datos copados. http://candle.pha.pa.us/main/writings/pgsql/hw_performance/index.html http://candle.pha.pa.us/main/writings/pgsql/performance.pdf Saludos, Juan M. Fera Maxiconsumo S.A. Ing. Gabriel Monsalvo escribi=F3: > Tom: > > We have a IBM NetServer i with 2.5 GB de Ram and RAID 5 with 137 GB, two > PIV Xeon at 1.6 GHZ... I mounted Linux in this server with > PostgreSQL 7.3, we start to deploy the database and we have a lot of > performance problems, i need help for tune up the server....i read the=20 > faqs, > a lots of documents about gets better performance but i don't obtain good > results...for example this table: OBLIGACION have 15 millions of records > > Column | Type | Modifiers > ----------+-----------------------+----------- > cuil | numeric(11,0) | > objeto | character varying(11) | > impuesto | numeric(3,0) | > concepto | numeric(3,0) | > tipobj | numeric(3,0) | > fecvtop | date | > fecvtod | date | > graba | date | > fecgen | date | > hora | character varying(4) | > operador | character varying(10) | > numoble | numeric(13,0) | > puesto | numeric(3,0) | > secsec | numeric(4,0) | > periodo | numeric(6,0) | > cuota | numeric(3,0) | > ctrlpago | numeric(3,0) | > ddjjd | numeric(3,0) | > tipopp | numeric(4,0) | > nroppago | numeric(8,0) | > marca | numeric(3,0) | > Indexes: numoble_oblig btree (numoble), > objeto_oblig btree (objeto), > periodo_oblig btree (periodo) > > sapym=3D# explain select max(numoble) from obligacion where periodo=3D200= 100; > QUERY PLAN > -------------------------------------------------------------------------= --- > ----------------------- > Aggregate (cost=3D6983070.47..6983070.47 rows=3D1 width=3D16) > -> Index Scan using periodo_oblig on obligacion (cost=3D0.00..6978186.18 > rows=3D1953717 width=3D16) > Index Cond: (periodo =3D 200100::numeric) > (3 rows) > > >> there is a index for obligacion on periodo but this query takes over 2 > minutes for finish. > > > sapym=3D# explain select count(*) from obligacion where periodo=3D200100; > QUERY PLAN > -------------------------------------------------------------------------= --- > ---------------------- > Aggregate (cost=3D6983070.47..6983070.47 rows=3D1 width=3D0) > -> Index Scan using periodo_oblig on obligacion (cost=3D0.00..6978186.18 > rows=3D1953717 width=3D0) > Index Cond: (periodo =3D 200100::numeric) > (3 rows) > > can you help to solve the problem? i really want to use PostgreSQL in my > organization but if i can't solve this problem we must > migrate to ugly DB2 . > > thanks in advance. > > Gabriel Monsalvo > > > > > > > ________________________________________________________________________ > > Este Mail Ha sido enviado por CorreoMovil=20 > - Su cuenta POP este donde este > --------------000207090203010300040407 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Gabriel:
 No soy un administrador de mucha experiencia, pero también sufrí muchos problemas de rendimiento hasta que modifiqué
dos parámetros en postgresql.conf y en el kernel.
  Los parámetros que cambie en postgresql.conf son "sort_mem", donde debes poner cuantos kilobytes va a utilizar cada proceso
cuando deba realizar el ordenamiento de una tabla (ojo que si pones 10 megabytes. en este parámetro son 10 megabytes. por cada proceso que
esté realizando un ordenamiento en ese momento), y el otro es "shared_buffers", que es la cantidad de bloques de 8 kb. que se van
a utilizar de memoria compartida, para subir las tablas completas a memoria, por ejemplo.  Este último espacio se ocupa una única vez
y lo utilizan todos los procesos que cree el postmaster.
 Mi (modesta) configuración es:
 sort_mem = 1024 (un megabyte)
 shared_buffers = 2048 (16 megabytes)
 Seguramente tus números van a ser más grandes y quizá debas modificar un par de parámetros del kernel vía /etc/sysctl.conf y luego
ejecutar sysctl.
 Los parámetros que hay que tocar son shmall y shmmax y los valores se deben expresar en bytes.  El valor que se debe poner debe
ser igual o mayor (expresado en bytes por supuesto) que el de shared_buffers.

 Quizá esto ya lo hayas probado, si no que sirva, te mando unos enlaces interesantes de donde saque esta información y otros datos
copados.

http://candle.pha.pa.us/main/writings/pgsql/hw_performance/index.html
http://candle.pha.pa.us/main/writings/pgsql/performance.pdf

 Saludos,

Juan M. Fera
Maxiconsumo S.A.

Ing. Gabriel Monsalvo escribió:
Tom:

We have a IBM NetServer i with 2.5 GB de Ram and RAID 5 with 137 GB, two
PIV Xeon at 1.6 GHZ... I mounted Linux in this server with
PostgreSQL 7.3, we start to deploy the database and we have a lot of
performance problems, i need help for tune up the server....i read the faqs,
a lots of documents about gets better performance but i don't obtain good
results...for example this table: OBLIGACION have 15 millions of records

Column | Type | Modifiers
----------+-----------------------+-----------
cuil | numeric(11,0) |
objeto | character varying(11) |
impuesto | numeric(3,0) |
concepto | numeric(3,0) |
tipobj | numeric(3,0) |
fecvtop | date |
fecvtod | date |
graba | date |
fecgen | date |
hora | character varying(4) |
operador | character varying(10) |
numoble | numeric(13,0) |
puesto | numeric(3,0) |
secsec | numeric(4,0) |
periodo | numeric(6,0) |
cuota | numeric(3,0) |
ctrlpago | numeric(3,0) |
ddjjd | numeric(3,0) |
tipopp | numeric(4,0) |
nroppago | numeric(8,0) |
marca | numeric(3,0) |
Indexes: numoble_oblig btree (numoble),
objeto_oblig btree (objeto),
periodo_oblig btree (periodo)

sapym=# explain select max(numoble) from obligacion where periodo=200100;
QUERY PLAN
----------------------------------------------------------------------------
-----------------------
Aggregate (cost=6983070.47..6983070.47 rows=1 width=16)
-> Index Scan using periodo_oblig on obligacion (cost=0.00..6978186.18
rows=1953717 width=16)
Index Cond: (periodo = 200100::numeric)
(3 rows)

>> there is a index for obligacion on periodo but this query takes over 2
minutes for finish.


sapym=# explain select count(*) from obligacion where periodo=200100;
QUERY PLAN
----------------------------------------------------------------------------
----------------------
Aggregate (cost=6983070.47..6983070.47 rows=1 width=0)
-> Index Scan using periodo_oblig on obligacion (cost=0.00..6978186.18
rows=1953717 width=0)
Index Cond: (periodo = 200100::numeric)
(3 rows)

can you help to solve the problem? i really want to use PostgreSQL in my
organization but if i can't solve this problem we must
migrate to ugly DB2 .

thanks in advance.

Gabriel Monsalvo







________________________________________________________________________

Este Mail Ha sido enviado por CorreoMovil - Su cuenta POP este donde este


--------------000207090203010300040407--