Re: Declarative partitioning grammar

Jeff Cohen <jcohen@greenplum.com>

From: Jeff Cohen <jcohen@greenplum.com>
To: Mike <ipso@snappymail.ca>
Cc: Gavin Sherry <swm@alcove.com.au>, pgsql-hackers@postgresql.org
Date: 2008-01-12T01:06:23Z
Lists: pgsql-hackers
On Jan 11, 2008, at 4:03 PM, Mike wrote:

> Pardon my ignorance as I've never actually used partitioning before  
> but
> plan to in the near future, but couldn't the grammar resemble a common
> WHERE clause more closely?
>>

Hi Mike,

Thanks for your suggestions.  The current syntax we chose is similar  
to syntax used by IBM, Oracle, and mysql, so it is familiar to folks  
who have used partitioning with other databases.  A WHERE clause  
would of course be understandable by everyone, but it makes error  
checking more difficult, since we want to ensure that partition  
specifications don't overlap.  In order to make such error checking  
feasible, we would have to restrict the set of predicates you can use  
in the WHERE clause, so it wouldn't be completely general anyway.

> Is there really a reason to not have a named partition as well?  
> Sure it
> saves a few keystrokes, but it makes trying to do anything with  
> them at
> a later date that much more difficult.

For the case of partition by HASH, you can just specify the number of  
buckets, so it might not be meaningful to name the partitions.  For  
range partitions, many users perform "rolling upgrades" on a regular  
basis, where they drop the oldest data and add a new partition with  
the latest data, so they might just refer to partitions by  
"position" (either an ordinal number or using a keyword like FIRST/ 
LAST).

kind regards,

Jeff