X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id F1B299FB202 for ; Thu, 14 Sep 2006 12:09:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 91911-05 for ; Thu, 14 Sep 2006 15:09:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-msa-out19.orange.fr (smtp19.orange.fr [80.12.242.18]) by postgresql.org (Postfix) with ESMTP id 816A39FB1F2 for ; Thu, 14 Sep 2006 12:09:46 -0300 (ADT) Received: from [192.168.1.10] (LSt-Amand-152-32-6-178.w82-127.abo.wanadoo.fr [82.127.21.178]) by mwinf1916.orange.fr (SMTP Server) with ESMTP id 4A6731C000C4; Thu, 14 Sep 2006 17:09:45 +0200 (CEST) X-ME-UUID: 20060914150945304.4A6731C000C4@mwinf1916.orange.fr Subject: Re: High CPU Load From: =?ISO-8859-1?Q?J=E9r=F4me?= BENOIS To: Dave Dutcher Cc: pgsql-performance@postgresql.org In-Reply-To: <004001c6d80e$bdef5bc0$8300a8c0@tridecap.com> References: <004001c6d80e$bdef5bc0$8300a8c0@tridecap.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-SL0c0rl4VYta8lURWBE5" Date: Thu, 14 Sep 2006 17:09:25 +0200 Message-Id: <1158246565.5226.59.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200609/159 X-Sequence-Number: 20845 --=-SL0c0rl4VYta8lURWBE5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Dave, Le jeudi 14 septembre 2006 =C3=A0 10:02 -0500, Dave Dutcher a =C3=A9crit : > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org=20 > > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > > J=C3=A9r=C3=B4me BENOIS > >=20 > explain analyze select distinct > > INTEGER_VALUE,DATE_VALUE,EI_ID,VALUE_TYPE,FLOAT_VALUE,ID,TEXT_ > > VALUE,CATEGORY_ID,STRING_VALUE,CATEGORYATTR_ID,NAME from (((=20 > > select distinct ei_id as EIID from mpng2_ei_attribute as=20 > > reqin1 where reqin1.CATEGORYATTR_ID =3D 0 AND reqin1.TEXT_VALUE=20 > > ilike '' and ei_id in ( select distinct ei_id as EIID from=20 > > mpng2_ei_attribute as reqin2 where reqin2.CATEGORYATTR_ID =3D 0=20 > > AND reqin2.TEXT_VALUE ilike '' and ei_id in ( select distinct=20 > > ei_id as EIID from mpng2_ei_attribute as reqin3 where=20 > > reqin3.NAME =3D '' AND reqin3.STRING_VALUE =3D '' ) ) ) ) ) as=20 > > req0 join mpng2_ei_attribute on req0.eiid =3D=20 > > mpng2_ei_attribute.ei_id order by ei_id asc; >=20 >=20 > That is a lot of distinct's. Sorts are one thing that can really use up > CPU. This query is doing lots of sorts, so its not surprising the CPU us= age > is high. =20 >=20 > On the subqueries you have a couple of cases where you say "... in (selec= t > distinct ...)" I don=E2=80=99t think the distinct clause is necessary in= that case. > I'm not a hundred percent sure, but you might want to try removing them a= nd > see if the query results are the same and maybe the query will execute > faster. Thanks for your advice, but the load was good with previous version of postgres -> 7.4.6 on the same server and same datas, same application, same final users ... So we supect some system parameter, but which ? With vmstat -s is showing a lot of "pages swapped out", have you an idea ? Thanls a lot, --=20 J=C3=A9r=C3=B4me, python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in 'sioneb@gnireenigne-aigra.rf'.split('@')])" --=-SL0c0rl4VYta8lURWBE5 Content-Type: application/pgp-signature; name=signature.asc Content-Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQBFCXClCDKlmlhpwnERAiDvAJ4wC8Ob5y7ValHK4x2KyUo5Dm20/ACdEN7d O804TAdCZtEurl6cXvEczp8= =Ku00 -----END PGP SIGNATURE----- --=-SL0c0rl4VYta8lURWBE5--