pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedReindex vs Vacuum analyze
3+ messages / 3 participants
[nested] [flat]
* Reindex vs Vacuum analyze
@ 2002-11-01 11:27 Gaetano Mendola <mendola@bigfoot.com>
2002-11-01 23:03 ` Re: Reindex vs Vacuum analyze Vincent Janelle <random@goblinstudios.com>
0 siblings, 1 reply; 3+ messages in thread
From: Gaetano Mendola @ 2002-11-01 11:27 UTC (permalink / raw)
To: pgsql-admin
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Reindex vs Vacuum analyze
2002-11-01 11:27 Reindex vs Vacuum analyze Gaetano Mendola <mendola@bigfoot.com>
@ 2002-11-01 23:03 ` Vincent Janelle <random@goblinstudios.com>
2002-11-02 00:25 ` Re: Reindex vs Vacuum analyze Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Janelle @ 2002-11-01 23:03 UTC (permalink / raw)
To: Gaetano Mendola <mendola@bigfoot.com>; +Cc: pgsql-admin
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Reindex vs Vacuum analyze
2002-11-01 11:27 Reindex vs Vacuum analyze Gaetano Mendola <mendola@bigfoot.com>
2002-11-01 23:03 ` Re: Reindex vs Vacuum analyze Vincent Janelle <random@goblinstudios.com>
@ 2002-11-02 00:25 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2002-11-02 00:25 UTC (permalink / raw)
To: Vincent Janelle <random@goblinstudios.com>; +Cc: Gaetano Mendola <mendola@bigfoot.com>; pgsql-admin
Vincent Janelle <random@goblinstudios.com> writes:
> when entries are deleted from an table they're not deleted from the
> index, and vacuum doesn't clean them up.
This is entirely false.
There is a problem with recovering space in an index if the range of
indexed values changes over time. But claiming that we don't delete
index entries is just plain wrong.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-11-02 00:25 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-01 11:27 Reindex vs Vacuum analyze Gaetano Mendola <mendola@bigfoot.com>
2002-11-01 23:03 ` Vincent Janelle <random@goblinstudios.com>
2002-11-02 00:25 ` Tom Lane <tgl@sss.pgh.pa.us>
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