Re: Inheritence versus delete from

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sven Willenberger <sven(at)dmv(dot)com>
Cc: Postgresql Performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Inheritence versus delete from
Date: 2005-03-01 01:07:20
Message-ID: 11427.1109639240@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Sven Willenberger <sven(at)dmv(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message John Arbash Meinel 2005-03-01 01:41:20 Re: Inheritence versus delete from
Previous Message Sven Willenberger 2005-02-28 23:59:13 Inheritence versus delete from