Re: Inheritence versus delete from - Mailing list pgsql-performance

From Tom Lane
Subject Re: Inheritence versus delete from
Date
Msg-id 11427.1109639240@sss.pgh.pa.us
Whole thread Raw
In response to Inheritence versus delete from  (Sven Willenberger <sven@dmv.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Sven Willenberger
Date:
Subject: Inheritence versus delete from
Next
From: John Arbash Meinel
Date:
Subject: Re: Inheritence versus delete from