pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vincent Janelle <random@goblinstudios.com>
To: Gaetano Mendola <mendola@bigfoot.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Reindex vs Vacuum analyze
Date: Fri, 1 Nov 2002 18:03:57 -0500
Message-ID: <20021101180357.069fa8e0.random@goblinstudios.com> (raw)
In-Reply-To: <aptuu2$1ejg$1@news.hub.org>
References: <aptuu2$1ejg$1@news.hub.org>

when entries are deleted from an table they're not deleted from the
index, and vacuum doesn't clean them up.  reindex recreates the index. 
It is suggested that you run a script at whatever necessary intervals to
recreate the indexes on your tables if they have large amounts of data
deleted from them on a regular basis.

Mine creates a temporary index, drops the old index, and renames the
temp index to the old one's name.  After all that, then it performs a
vacuum.

On Fri, 1 Nov 2002 12:27:48 +0100
"Gaetano Mendola" <mendola@bigfoot.com> wrote:

> I repeat my simple experience for
> know about what is going on:
> 
> push=# explain analyze select * from jobs where status = 'r';
> NOTICE:  QUERY PLAN:
> 
> Index Scan using idx_jobs_status_r on jobs  (cost=0.00..8.57 rows=3770
> width=49)
>  (actual time=19.26..1295.73 rows=5 loops=1)
> Total runtime: 1295.85 msec
> 
> EXPLAIN
> push=# vacuum analyze jobs;
> VACUUM
> push=# explain analyze select * from jobs where status = 'r';
> NOTICE:  QUERY PLAN:
> 
> Index Scan using idx_jobs_status_r on jobs  (cost=0.00..3.12 rows=1
> width=49)
>  (actual time=0.08..1318.36 rows=5 loops=1)
> Total runtime: 1318.48 msec
> 
> EXPLAIN
> push=# reindex table jobs;
> REINDEX
> push=# explain analyze select * from jobs where status = 'r';
> NOTICE:  QUERY PLAN:
> 
> Index Scan using idx_jobs_status_r on jobs  (cost=0.00..3.12 rows=1
> width=49) (actual time=0.04..0.15 rows=4 loops=1)
> Total runtime: 0.24 msec



view thread (3+ messages)  latest in thread

Message-ID: <20021101180357.069fa8e0.random@goblinstudios.com>
Permalink:  ../20021101180357.069fa8e0.random@goblinstudios.com/
Also on:    postgresql.org/message-id/20021101180357.069fa8e0.random@goblinstudios.com

 · 

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: random@goblinstudios.com, mendola@bigfoot.com
  Subject: Re: Reindex vs Vacuum analyze
  In-Reply-To: <20021101180357.069fa8e0.random@goblinstudios.com>
  References: <aptuu2$1ejg$1@news.hub.org> <20021101180357.069fa8e0.random@goblinstudios.com>

* 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