pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
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 20:07:20 -0500
Message-ID: <11427.1109639240@sss.pgh.pa.us> (raw)
In-Reply-To: <1109635153.4620.44.camel@lanshark.dmv.com>
References: <1109635153.4620.44.camel@lanshark.dmv.com>

Sven Willenberger <sven@dmv.com> writes:
> 3) Each month:
> CREATE newmonth_dynamically_named_table (like mastertable) INHERITS
> (mastertable);
> modify the copy.sql script to copy newmonth_dynamically_named_table;
> pg_dump 3monthsago_dynamically_named_table for archiving;
> drop table 3monthsago_dynamically_named_table;

A number of people use the above approach.  It's got some limitations,
mainly that the planner isn't super bright about what you are doing
--- in particular, joins involving such a table may work slowly.

On the whole I'd probably go with the other approach (one big table).
A possible win is to use CLUSTER rather than VACUUM ANALYZE to recover
space after your big deletes; however this assumes that you can schedule
downtime to do the CLUSTERs in.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <11427.1109639240@sss.pgh.pa.us>
Permalink:  ../11427.1109639240@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11427.1109639240@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, sven@dmv.com
  Subject: Re: Inheritence versus delete from
  In-Reply-To: <11427.1109639240@sss.pgh.pa.us>

* 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