Re: Declarative partitioning grammar

Zeugswetter Andreas OSB sIT <andreas.zeugswetter@s-itsolutions.at>

From: "Zeugswetter Andreas ADI SD" <Andreas.Zeugswetter@s-itsolutions.at>
To: "Markus Schiltknecht" <markus@bluegap.ch>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>, "Jeff Cohen" <jcohen@greenplum.com>, "Warren Turkal" <turkal@google.com>, "Ron Mayer" <rm_pg@cheapcomplexdevices.com>, "Gavin Sherry" <swm@alcove.com.au>, <pgsql-hackers@postgresql.org>
Date: 2008-01-16T13:13:41Z
Lists: pgsql-hackers
 
> > Personally I find the automatic partition idea intriguing, where you
> > only have to choose an expression that equates to one value (value
> > group) per partition (and possibly a way to derive a 
> partition name).
> 
> IMO, better go right to a fully automated approach. Or why would you 
> need partition names in such a case?

Yes, I tend to aggree on that, with the exception that I think the
partition borders should be declarative expressions (equal in syntax to
a GROUP BY clause). 

Names are only for a short and crisp way to identify the partition for
the following operations:
- drop/detach data in a partition (as opposed to a normal delete)
- move to/create in other tablespace (I don't value that one, but others
have)
- reorg, create index

The drop can probably be done straight from a normal delete (a problem
is RI and triggers though).
The normal delete would need to have the smarts, that a delete covers a
whole partition, and thus mark the whole partition dead instead of it's
individual rows.

A detach would need some extra syntax, but could also be based on a
where clause that specifies which partitions are to be detached. I am
not so sure about how to usefully do the reorg part with where clauses.

Andreas