pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Neil Conway <nconway@klamath.dyndns.org>
To: Dmitry Tkach <dmitry@openratings.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Alter/update large tables - VERRRY annoying behaviour!
Date: Mon, 15 Apr 2002 14:24:51 -0400
Message-ID: <20020415142451.1d8a21d0.nconway@klamath.dyndns.org> (raw)
In-Reply-To: <3CBB08C8.7000705@openratings.com>
References: <3CBB08C8.7000705@openratings.com>

On Mon, 15 Apr 2002 13:07:20 -0400
"Dmitry Tkach" <dmitry@openratings.com> wrote:
> Hi, everybody!

Hi Dmitry! Don't cross-post! It's annoying!

> This took me awfully long, but worked (I guess).
> I say 'I guess', because I wasn't able so far to verify that - when I triued to do
> 
> select * from a limit 1;
> 
> It just hungs on me ... at least, it looks like it does.

This didn't hang, it just requires a sequential scan of the whole table.
As you observe below, it will also need to scan through dead tuples,
but that is just a product of MVCC and there's no real way around
it. Once you VACUUM the dead tuples will be removed and sequential
scans should be fast once more.

And before assuming that something has hung, it's a good idea to
look at the output of EXPLAIN for that query, as well as monitoring
system performance (through top, vmstat, etc) to see what the
system is doing.

> Lucky me, I have compiled the backend from sources with full debug info, because if I hadn't done that,
> (as most users), I would certainly had thought, that my database is hopelessly corrupted, and would have to
> recreate it from scratch :-(

That's a ludicrous conclusion.

> First of all, a question for you - is ANY update to a table equivalent (in this respect) to a delete+insert?

Yes, AFAIK -- MVCC requires this.

> - Vacuum, isn't the speediest thing in the world too (it's been running for a hour now, and still has not finished).

Is this 7.2? If not, VACUUM should be substantially faster in 7.2.
In any case, you'll always want to VACUUM or VACUUM FULL (and
ANALYZE) when you change your tables in such a dramatic fashion.

Cheers,

Neil

-- 
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC



view thread (9+ messages)  latest in thread

Message-ID: <20020415142451.1d8a21d0.nconway@klamath.dyndns.org>
Permalink:  ../20020415142451.1d8a21d0.nconway@klamath.dyndns.org/
Also on:    postgresql.org/message-id/20020415142451.1d8a21d0.nconway@klamath.dyndns.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: nconway@klamath.dyndns.org, dmitry@openratings.com, pgsql-general@postgresql.org
  Subject: Re: Alter/update large tables - VERRRY annoying behaviour!
  In-Reply-To: <20020415142451.1d8a21d0.nconway@klamath.dyndns.org>
  References: <3CBB08C8.7000705@openratings.com> <20020415142451.1d8a21d0.nconway@klamath.dyndns.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