Re: Syntax for partitioning

Dimitri Fontaine <dimitri@2ndquadrant.fr>

From: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
To: Martijn van Oosterhout <kleptog@svana.org>
Cc: Dimitri Fontaine <dimitri@2ndQuadrant.fr>, Jeff Janes <jeff.janes@gmail.com>, Thom Brown <thom@linux.com>, Robert Haas <robertmhaas@gmail.com>, Jaime Casanova <jaime@2ndquadrant.com>, Simon Riggs <simon@2ndquadrant.com>, Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>, pgsql-hackers@postgresql.org, Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>, Itagaki Takahiro <itagaki.takahiro@gmail.com>
Date: 2011-11-15T10:40:30Z
Lists: pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> That said, I still don't see how you can enforce a unique index over
> multiple segments over something other than the partition key while
> still allowing quick dropping of segments.  If you can fix that you can
> make it work for the current inheritence-style partitioning.

Well the Primary Key and the Physical Map Index do not need to be on the
same set of columns.

>> If you happen to drop a part of the data that fits in one or more
>> segments (and with a decent fillfactor you need less than 1GB to get
>> there), then you can unlink() whole files at a time.  That would be the
>> goal here.
>
> I feel uncomfortable with the "happen to". You can add the magic too,
> but for scripting purposes I'd feel better if it could be done via DDL
> also. That way typos don't end up being 5 day queries all of a sudden.

If the data fills less than a segment then you can't unlink() the file,
you have to mark the tuples / pages as free space.  If you have a
partial index matching the whole portion of data you're removing, you
can still drop it before hand — or maybe the system can be instructed to
do so?

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support