pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ragnar <gnari@hive.is>
To: Mario Behring <mariobehring@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to reduce a database
Date: Fri, 29 Dec 2006 17:18:41 +0000
Message-ID: <1167412721.6369.371.camel@localhost.localdomain> (raw)
In-Reply-To: <20061229150930.51974.qmail@web30006.mail.mud.yahoo.com>
References: <20061229150930.51974.qmail@web30006.mail.mud.yahoo.com>

On fös, 2006-12-29 at 07:09 -0800, Mario Behring wrote:

> Anyway, the openNMS database is very large now, more than 25GB
> (considering all tables) and I am starting to have disk space issues.
> The openNMS product has a vacuumdb procedure that runs every 24 hours
> and reads a vacuumd-configuration.xml file for parameters on what to
> do. 

> The problem is that this process is not reducing the database size.
> What I need to do is to delete some records based on timestamp fileds
> or something like that. I don't know how to do it though.

before you start deleting random rows in a database you are not
too familiar with, let us start by trying to determine your
actual problem.

you should issue a manual VACUUM VERBOSE, and look at the
output of that first. possibly you will find that the database 
is suffering from bloat due to too small fsm settings.

if that is the case, a VACUUM FULL might be indicated, but
note that it will take exclusive locks, so you should
schedule that for some time where you can afford downtime.

if this is not enough, then you can take a look at deleting
rows, but you would probably get better advice on that
from the OpenNMS community. I assume they have
mailinglists or forums. 


> <VacuumdConfiguration period="86400000" >
>     <statement><!-- this deletes all the nodes that have been marked
> as deleted - it relies on cascading deletes --> DELETE FROM node
> WHERE node.nodeType = 'D'; </statement>
>     <statement><!-- this deletes all the interfaces that have been
> marked as deleted - it relies on cascading deletes --> DELETE FROM
> ipInterface WHERE ipInterface.isManaged = 'D'; </statement>
>     <statement><!-- this deletes all the services that have been
> marked as deleted - it relies on cascading deletes --> DELETE FROM if
> Services WHERE ifServices.status = 'D'; </statement>
>     <statement><!-- this deletes any events that are not associated
> with outages - Thanks to Chris Fedde for this --> DELETE FROM even
> ts WHERE NOT EXISTS (SELECT svclosteventid FROM outages WHERE
> svclosteventid = events.eventid UNION SELECT svcregainedeventid FROM
> out      ages WHERE svcregainedeventid = events.eventid UNION SELECT
> eventid FROM notifications WHERE eventid = events.eventid) AND
> eventtime &      lt; now() - interval '6 weeks'; </statement>
> </VacuumdConfiguration>

these all seem to be deletes (no VACUUMs), so you might want
to check if vacuumd is actually running to be 100% sure.

also, what version postgres is this ?

gnari

> 




view thread (3+ messages)  latest in thread

Message-ID: <1167412721.6369.371.camel@localhost.localdomain>
Permalink:  ../1167412721.6369.371.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1167412721.6369.371.camel@localhost.localdomain

 · 

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-sql@postgresql.org
  Cc: gnari@hive.is, mariobehring@yahoo.com
  Subject: Re: How to reduce a database
  In-Reply-To: <1167412721.6369.371.camel@localhost.localdomain>

* 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