Re: How to reduce a database - Mailing list pgsql-sql

From Ragnar
Subject Re: How to reduce a database
Date
Msg-id 1167412721.6369.371.camel@localhost.localdomain
Whole thread Raw
In response to How to reduce a database  (Mario Behring <mariobehring@yahoo.com>)
List pgsql-sql
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

> 



pgsql-sql by date:

Previous
From: Mario Behring
Date:
Subject: How to reduce a database
Next
From: Mason
Date:
Subject: I would like to alter the COPY command