pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jérôme BENOIS <benois@argia-engineering.fr>
To: Evgeny Gridasov <eugene@i-free.ru>
Cc: Dave Dutcher <dave@tridecap.com>
Cc: pgsql-performance@postgresql.org, Xavier Milliard <milliard@argia.fr>
Subject: Re: High CPU Load
Date: Thu, 14 Sep 2006 23:37:21 +0200
Message-ID: <1158269841.5167.9.camel@localhost.localdomain> (raw)
In-Reply-To: <20060914204739.4a4371f8.eugene@i-free.ru>
References: <004001c6d80e$bdef5bc0$8300a8c0@tridecap.com>
	<1158246565.5226.59.camel@localhost.localdomain>
	<20060914204739.4a4371f8.eugene@i-free.ru>

Hi Evgeny,

Le jeudi 14 septembre 2006 à 20:47 +0400, Evgeny Gridasov a écrit :
> Jérôme,
> 
> How many concurrent connections do you have?
I have between 300 and 400 concurrent connections.

> Because You've got only 2GB of ram this is important! Postgres process
> takes some bytes in memory =) .. I don't exactly how many,
> but thinking if it is about 2Mb you'll get about 1Gb of ram used only by
> postgres' processes (for 512 connections)!
> Don't forget about your 512Mb shared memory setting,
> postgres shared libraries and the OS filesystem cache...
> 
> I hope your postgres binaries are not statically linked?
no, i not use static binaries

> Try using connection pooling in your software, or add some RAM, it's cheap.
> And I think that work_mem of 65536 is too high for your system...

I already use connection pool but i have many servers in front of database server.

Ok i will test new lower work_mem tomorrow.

-- 
Jérôme,

python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'sioneb@gnireenigne-aigra.rf'.split('@')])"
> On Thu, 14 Sep 2006 17:09:25 +0200
> Jérôme BENOIS <benois@argia-engineering.fr> wrote:
> 
> > Hi Dave,
> > Le jeudi 14 septembre 2006 à 10:02 -0500, Dave Dutcher a écrit :
> > > > -----Original Message-----
> > > > From: pgsql-performance-owner@postgresql.org 
> > > > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of 
> > > > Jérôme BENOIS
> > > > 
> > >  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 ((( 
> > > > select distinct ei_id as EIID from mpng2_ei_attribute as 
> > > > reqin1 where reqin1.CATEGORYATTR_ID = 0 AND reqin1.TEXT_VALUE 
> > > > ilike '' and ei_id in ( select distinct ei_id as EIID from 
> > > > mpng2_ei_attribute as reqin2 where reqin2.CATEGORYATTR_ID = 0 
> > > > AND reqin2.TEXT_VALUE ilike '' and ei_id in ( select distinct 
> > > > ei_id as EIID from mpng2_ei_attribute as reqin3 where 
> > > > reqin3.NAME = '' AND reqin3.STRING_VALUE = '' ) ) ) ) ) as 
> > > > req0 join mpng2_ei_attribute on req0.eiid = 
> > > > mpng2_ei_attribute.ei_id order by ei_id asc;
> > > 
> > > 
> > > 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 usage
> > > is high.  
> > > 
> > > On the subqueries you have a couple of cases where you say "... in (select
> > > distinct ...)"  I don’t think the distinct clause is necessary in that case.
> > > I'm not a hundred percent sure, but you might want to try removing them and
> > > 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,
> 
> 

Attachments:

  signature.asc (application/pgp-signature, 190B) download

view thread (30+ messages)  latest in thread

Message-ID: <1158269841.5167.9.camel@localhost.localdomain>
Permalink:  ../1158269841.5167.9.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1158269841.5167.9.camel@localhost.localdomain

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: benois@argia-engineering.fr, eugene@i-free.ru, dave@tridecap.com, milliard@argia.fr
  Subject: Re: High CPU Load
  In-Reply-To: <1158269841.5167.9.camel@localhost.localdomain>

* 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