Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B22DB9FA49E for ; Sun, 22 Jul 2007 12:52:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 30674-09 for ; Sun, 22 Jul 2007 12:52:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.234]) by postgresql.org (Postfix) with ESMTP id CD2309FA206 for ; Sun, 22 Jul 2007 12:52:35 -0300 (ADT) Received: by nz-out-0506.google.com with SMTP id l8so889354nzf for ; Sun, 22 Jul 2007 08:52:35 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=D1feIWdK/N18bWzFlsT8z5/wPEqrIddstUUjJZqi5IFsVR73M9t979qquXAOiUGyIwrMUECBP0Z9VhTsB5+AzMex2hnzudb8iIwRAKtF4Q89LjfUJYvJ6vn0wRh0ERdzF/0I9773p0iylUHkZ3Cs2DrXOBjgCk6MgFkfuvDEhWE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S7+BK1/ytg8uTW0Ra9p+Na8TktOFtSQAFoO2VCSvIVjUC/YqsOnUQyrm995IB1OBXfldKqwurKAxwGMp26uGHyznXqWROxkQXTcnONx8kfnPJ4D3p4NoAgsBN/h5t7nsR+dukt916BdTP0LA1etu0imNlUF2vaBQ5EcyUvu4pxs= Received: by 10.143.2.19 with SMTP id e19mr166237wfi.1185119554556; Sun, 22 Jul 2007 08:52:34 -0700 (PDT) Received: by 10.142.80.10 with HTTP; Sun, 22 Jul 2007 08:52:34 -0700 (PDT) Message-ID: <162867790707220852q2369eb3fi2c268925d1bd198@mail.gmail.com> Date: Sun, 22 Jul 2007 17:52:34 +0200 From: "Pavel Stehule" To: "Jozsef Szalay" Subject: Re: Simple select hangs while CPU close to 100% Cc: pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/284 X-Sequence-Number: 25968 Hello did you vacuum? It's good technique do vacuum table after remove bigger number of rows. Regards Pavel Stehule 2007/7/22, Jozsef Szalay : > > > > > I'm having this very disturbing problem. I got a table with about 100,000 > rows in it. Our software deletes the majority of these rows and then bulk > loads another 100,000 rows into the same table. All this is happening wit= hin > a single transaction. I then perform a simple "select count(*) from =85" > statement that never returns. In the mean time, the backend Postgres proc= ess > is taking close to 100% of the CPU. The hang-up does not always happen on > the same statement but eventually it happens 2 out of 3 times. If I dump = and > then restore the schema where this table resides the problem is gone unti= l > the next time we run through the whole process of deleting, loading and > querying the table. > > > > There is no other activity in the database. All requested locks are grant= ed. > > > > Has anyone seen similar behavior? > > > > Some details: > > > > Postgres v 8.1.2 > > Linux Fedora 3 > > > > shared_buffers =3D 65536 > > temp_buffers =3D 32768 > > work_mem =3D 131072 > > maintenance_work_mem =3D 131072 > > max_stack_depth =3D 8192 > > max_fsm_pages =3D 40000 > > wal_buffers =3D 16 > > checkpoint_segments =3D 16 > > > > > > top reports > > > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > > 19478 postgres 25 0 740m 721m 536m R 99.7 4.4 609:41.16 postmaster > > > > ps =96ef | grep postgres reports > > > > postgres 19478 8061 99 00:11 ? 10:13:03 postgres: user dbase [loc= al] > SELECT > > > > strace =96p 19478 > > no system calls reported > > > > > > Thanks for the help! > > Jozsef