pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Arbash Meinel <john@arbash-meinel.com>
To: Sven Willenberger <sven@dmv.com>
Cc: Postgresql Performance list <pgsql-performance@postgresql.org>
Subject: Re: Inheritence versus delete from
Date: Mon, 28 Feb 2005 19:41:20 -0600
Message-ID: <4223C840.1060109@arbash-meinel.com> (raw)
In-Reply-To: <1109635153.4620.44.camel@lanshark.dmv.com>
References: <1109635153.4620.44.camel@lanshark.dmv.com>

Sven Willenberger wrote:

>Trying to determine the best overall approach for the following
>scenario:
>
>Each month our primary table accumulates some 30 million rows (which
>could very well hit 60+ million rows per month by year's end). Basically
>there will end up being a lot of historical data with little value
>beyond archival.
>
>
>
If this statement is true, then 2 seems the best plan.

>2) Each month:
>SELECT * INTO 3monthsago_dynamically_named_table FROM bigtable WHERE
>targetdate < $3monthsago;
>DELETE FROM bigtable where targetdate < $3monthsago;
>VACUUM ANALYZE bigtable;
>pg_dump 3monthsago_dynamically_named_table for archiving;
>
>
>
It seems like this method would force the table to stay small, and would
keep your queries fast.  But if you ever actually *need* the old data,
then you start having problems.

...

I think (3) would tend to force a whole bunch of joins (one for each
child table), rather than just one join against 3months of data.

>Any takes on which approach makes most sense from a performance and/or
>maintenance point of view and are there other options I may have missed?
>
>Sven Willenberger
>
>
If you can get away with it 2 is the best.

John
=:->

Attachments:

  signature.asc (application/pgp-signature, 252B) download

view thread (6+ messages)  latest in thread

Message-ID: <4223C840.1060109@arbash-meinel.com>
Permalink:  ../4223C840.1060109@arbash-meinel.com/
Also on:    postgresql.org/message-id/4223C840.1060109@arbash-meinel.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: john@arbash-meinel.com, sven@dmv.com
  Subject: Re: Inheritence versus delete from
  In-Reply-To: <4223C840.1060109@arbash-meinel.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