pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Tauno Williams <adamtaunowilliams@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Simple select hangs while CPU close to 100%
Date: Sun, 22 Jul 2007 14:32:45 -0400
Message-ID: <1185129165.4159.1.camel@aleph.whitemice.org> (raw)
In-Reply-To: <E387E2E9622FDD408359F98BF183879EE02634@dc1.storediq.com>
References: <E387E2E9622FDD408359F98BF183879EE02634@dc1.storediq.com>


> 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 within a single transaction. I then perform a simple
> “select count(*) from …” statement that never returns. In the mean

COUNT(*) is always slow;  but either way if the process is deleting and
then adding records, can't you just keep track of how may records you
loaded [aka count++] rather than turning around and asking the database
before any statistics have had a chance to be updated.

>  time, the backend Postgres process 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 until 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
> granted. 





view thread (13+ messages)  latest in thread

Message-ID: <1185129165.4159.1.camel@aleph.whitemice.org>
Permalink:  ../1185129165.4159.1.camel@aleph.whitemice.org/
Also on:    postgresql.org/message-id/1185129165.4159.1.camel@aleph.whitemice.org

 · 

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: adamtaunowilliams@gmail.com
  Subject: Re: Simple select hangs while CPU close to 100%
  In-Reply-To: <1185129165.4159.1.camel@aleph.whitemice.org>

* 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