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 D90799FA502 for ; Thu, 14 Sep 2006 12:56:59 -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 13037-08 for ; Thu, 14 Sep 2006 15:56:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 733B39FB1E0 for ; Thu, 14 Sep 2006 12:56:53 -0300 (ADT) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Thu, 14 Sep 2006 15:56:53 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 14 Sep 2006 10:56:52 -0500 Subject: Re: High CPU Load From: Scott Marlowe To: Dave Dutcher Cc: =?ISO-8859-1?Q?=27J=E9r=F4me?= BENOIS' , pgsql-performance@postgresql.org In-Reply-To: <004001c6d80e$bdef5bc0$8300a8c0@tridecap.com> References: <004001c6d80e$bdef5bc0$8300a8c0@tridecap.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-Id: <1158249411.24726.17.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 14 Sep 2006 10:56:52 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=SPF_PASS, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200609/161 X-Sequence-Number: 20847 On Thu, 2006-09-14 at 10:02, Dave Dutcher wrote: > > -----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 I'm gonna make a SWAG here and guess that maybe your 7.4 db was initdb'd with a locale of C and the new one is initdb'd with a real locale, like en_US. Can J=C3=A9r=C3=B4me confirm or deny this?