pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Browne <cbbrowne@libertyrms.info>
To: pgsql-performance@postgresql.org
Subject: Re: reindex/vacuum locking/performance?
Date: Fri, 03 Oct 2003 17:34:14 -0400
Message-ID: <60d6de9fah.fsf@dev6.int.libertyrms.info> (raw)
References: <16253.56074.737161.470428@jump.bivio.com>

nagler@bivio.biz (Rob Nagler) writes:
> I've read some posts that says vacuum doesn't lock, but my experience
> today indicates the opposite.  It seemed that "vacuum full analyze"
> was locked waiting and so were other postmaster processes.  It
> appeared to be deadlock, because all were in "WAITING" state according
> to ps.  I let this go for about a 1/2 hour, and then killed the vacuum
> at which point all other processes completed normally.

VACUUM FULL certainly does lock.

See the man page:

   INPUTS
       FULL   Selects ``full'' vacuum, which may reclaim more space, but takes
              much longer and exclusively locks the table.

The usual answer is that you probably _didn't_ want to VACUUM FULL.

VACUUM ('no full') does NOT block updates.

> The same thing seemed to be happening with reindex on a table.  It
> seems that the reindex locks the table and some other resource which
> then causes deadlock with other active processes.

Not surprising either.  While the reindex takes place, updates to that
table have to be deferred.

> Another issue seems to be performance.  A reindex on some indexes is
> taking 12 minutes or so.  Vacuum seems to be slow, too.  Way longer
> than the time it takes to reimport the entire database (30 mins).

That seems a little surprising.

> In summary, I suspect that it is better from a UI perspective to
> bring down the app on Sat at 3 a.m and reimport with a fixed time
> period than to live through reindexing/vacuuming which may deadlock.
> Am I missing something?

Consider running pg_autovacuum, and thereby do a little bit of
vacuuming here and there all the time.  It DOESN'T block, so unless
your system is really busy, it shouldn't slow things down to a major
degree.
-- 
"cbbrowne","@","libertyrms.info"
<http://dev6.int.libertyrms.com/;
Christopher Browne
(416) 646 3304 x124 (land)



view thread (37+ messages)  latest in thread

Message-ID: <60d6de9fah.fsf@dev6.int.libertyrms.info>
Permalink:  ../60d6de9fah.fsf@dev6.int.libertyrms.info/
Also on:    postgresql.org/message-id/60d6de9fah.fsf@dev6.int.libertyrms.info

 · 

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: cbbrowne@libertyrms.info
  Subject: Re: reindex/vacuum locking/performance?
  In-Reply-To: <60d6de9fah.fsf@dev6.int.libertyrms.info>

* 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