pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Vacuuming and re-indexing (was Re: Vacuum meaning)
4+ messages / 4 participants
[nested] [flat]

* Vacuuming and re-indexing (was Re: Vacuum meaning)
@ 2003-01-03 15:18 David F. Skoll <dfs@roaringpenguin.com>
  2003-01-03 17:22 ` Re: Vacuuming and re-indexing (was Re: Vacuum meaning) Gaetano Mendola <mendola@bigfoot.com>
  2003-01-03 23:39 ` Re: Vacuuming and re-indexing (was Re: Vacuum meaning) Bruce Momjian <pgman@candle.pha.pa.us>
  2003-01-09 21:25 ` Re: Vacuuming and re-indexing (was Re: Vacuum meaning) Jeff Boes <jboes@nexcerpt.com>
  0 siblings, 3 replies; 4+ messages in thread

From: David F. Skoll @ 2003-01-03 15:18 UTC (permalink / raw)
  To: pgsql-admin

On Fri, 3 Jan 2003, Robert Treat wrote:

> The purpose of a regular aka "lazy" vacuum is to mark dead tuples
> generated from updates and deletions as reusable by future inserts and
> updates. It doesn't recover any disk space, but allows currently wasted
> space to be reused. "Full" vacuums, otoh, serve the purpose of
> reclaiming unused space.

The whole "vaccuum" concept is, IMHO, one of the weakest aspects of
PostgreSQL.  It really makes it difficult to build products around
PostgreSQL unless you have a good idea of the database churn, which
isn't always possible.

Is there any way to adaptively vacuum the database?  By this, I mean
is it possible to run a query every few minutes and decide to vacuum
based on the query results?

> However, based on your 4:00 output, I'd say you need to start doing more
> frequent lazy vacuums on user_logs_digest and user_traffic. Try and
> determine how long it takes for 15% of those tables to be updated or
> delete/insert and then set a cron task to do a lazy vacuum analyze at
> that frequency. (This is in additional to regular vacuuming on the rest
> of the database)

Is there any query that can return that info?  A query that tells how
many dead tuples there are?

> It's possible your suffering index bloat as well and you might need to
> do some regular reindexing,

Again, this sounds ugly.  How do you determine this?  How do you get your
database to be reindexed as often as needed, but not too often?

--
David.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Vacuuming and re-indexing (was Re: Vacuum meaning)
  2003-01-03 15:18 Vacuuming and re-indexing (was Re: Vacuum meaning) David F. Skoll <dfs@roaringpenguin.com>
@ 2003-01-03 17:22 ` Gaetano Mendola <mendola@bigfoot.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Gaetano Mendola @ 2003-01-03 17:22 UTC (permalink / raw)
  To: pgsql-admin


""David F. Skoll"" <dfs@roaringpenguin.com> wrote in message
news:Pine.LNX.4.50.0301031015260.2549-100000@shishi.roaringpenguin.com...
> > It's possible your suffering index bloat as well and you might need to
> > do some regular reindexing,
>
> Again, this sounds ugly.  How do you determine this?  How do you get your
> database to be reindexed as often as needed, but not too often?

Sound more ugly considering that some times the reindex is not possible
if the server is stressed ( the reindex hang ) for my experience
instead of do a reindex is better delete the indexes and recreate them.

With the following query you can obtain the size of each table or index:

SELECT relname, relpages * 8 AS Mb, reltuples
FROM pg_class
ORDER BY relpages DESC
LIMIT 10;

If you use the 7.3 I think you should multiply for 11.





Ciao
Gaetano.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Vacuuming and re-indexing (was Re: Vacuum meaning)
  2003-01-03 15:18 Vacuuming and re-indexing (was Re: Vacuum meaning) David F. Skoll <dfs@roaringpenguin.com>
@ 2003-01-03 23:39 ` Bruce Momjian <pgman@candle.pha.pa.us>
  2 siblings, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2003-01-03 23:39 UTC (permalink / raw)
  To: David F. Skoll <dfs@roaringpenguin.com>; +Cc: pgsql-admin


No question vacuuming is ugly.  My hope is that some of the statistics
collection can be used to automatic vacuum for 7.4.  We have some folks
working on that.

---------------------------------------------------------------------------

David F. Skoll wrote:
> On Fri, 3 Jan 2003, Robert Treat wrote:
> 
> > The purpose of a regular aka "lazy" vacuum is to mark dead tuples
> > generated from updates and deletions as reusable by future inserts and
> > updates. It doesn't recover any disk space, but allows currently wasted
> > space to be reused. "Full" vacuums, otoh, serve the purpose of
> > reclaiming unused space.
> 
> The whole "vaccuum" concept is, IMHO, one of the weakest aspects of
> PostgreSQL.  It really makes it difficult to build products around
> PostgreSQL unless you have a good idea of the database churn, which
> isn't always possible.
> 
> Is there any way to adaptively vacuum the database?  By this, I mean
> is it possible to run a query every few minutes and decide to vacuum
> based on the query results?
> 
> > However, based on your 4:00 output, I'd say you need to start doing more
> > frequent lazy vacuums on user_logs_digest and user_traffic. Try and
> > determine how long it takes for 15% of those tables to be updated or
> > delete/insert and then set a cron task to do a lazy vacuum analyze at
> > that frequency. (This is in additional to regular vacuuming on the rest
> > of the database)
> 
> Is there any query that can return that info?  A query that tells how
> many dead tuples there are?
> 
> > It's possible your suffering index bloat as well and you might need to
> > do some regular reindexing,
> 
> Again, this sounds ugly.  How do you determine this?  How do you get your
> database to be reindexed as often as needed, but not too often?
> 
> --
> David.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Vacuuming and re-indexing (was Re: Vacuum meaning)
  2003-01-03 15:18 Vacuuming and re-indexing (was Re: Vacuum meaning) David F. Skoll <dfs@roaringpenguin.com>
@ 2003-01-09 21:25 ` Jeff Boes <jboes@nexcerpt.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Jeff Boes @ 2003-01-09 21:25 UTC (permalink / raw)
  To: pgsql-admin

On Fri, 03 Jan 2003 10:19:44 -0500, David F. Skoll wrote:

> Is there any way to adaptively vacuum the database?  By this, I mean is
> it possible to run a query every few minutes and decide to vacuum based
> on the query results?

You may want to investigate this:

http://gborg.postgresql.org/project/pgavd/projdisplay.php

I started to, but haven't had the time to really dig into it.

 

-- 
Jeff Boes                                      vox 616.226.9550 ext 24
Database Engineer                                     fax 616.349.9076
Nexcerpt, Inc.                                 http://www.nexcerpt.com
           ...Nexcerpt... Extend your Expertise



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-01-09 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-03 15:18 Vacuuming and re-indexing (was Re: Vacuum meaning) David F. Skoll <dfs@roaringpenguin.com>
2003-01-03 17:22 ` Gaetano Mendola <mendola@bigfoot.com>
2003-01-03 23:39 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-01-09 21:25 ` Jeff Boes <jboes@nexcerpt.com>

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