Re: Partitioning option for COPY

Emmanuel Cecchet <manu@asterdata.com>

From: Emmanuel Cecchet <manu@asterdata.com>
To: Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Cc: Emmanuel Cecchet <Emmanuel.Cecchet@asterdata.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2009-11-12T00:53:58Z
Lists: pgsql-hackers
Hi,
>> I have extracted the partitioning option for COPY (removed the error 
>> logging part) from the previous patch.
>>     
>
> We can use an INSERT trigger to route tuples into partitions even now.
> Why do you need an additional router for COPY? 
Tom has already explained on the list why using a trigger was a bad idea 
(and I know we can use a trigger since I am the one who wrote it).
If you look at the code you will see that you can do optimizations in 
the COPY code that you cannot do in the trigger.

>  Also, it would be nicer
> that the router can works not only in COPY but also in INSERT.
>   
As 8.5 will at best provide a syntactic hack on top of the existing 
constraint implementation, I think that it will not hurt to have routing 
in COPY since we will not have it anywhere otherwise.
> BTW, I'm working on meta data of partitioning now. Your "partitioning"
> option in COPY could be replaced with the catalog.
>   
This implementation is only for the current 8.5 and it will not be 
needed anymore once we get a fully functional partitioning in Postgres 
which seems to be for a future version.

Best regards,
Emmanuel

-- 
Emmanuel Cecchet
Aster Data
Web: http://www.asterdata.com