Thread: Partitioning and Foreign Keys

Partitioning and Foreign Keys

From
Volkan YAZICI
Date:
Hi,

We have a customers database growing ~1,000 rows per day. (Nearly, %40
of the table is garbage and won't get queried that often in the
future. But we keep them for statistical analysing purposes of
previous jobs.) Despite table allocates relatively small size on the
disk, requirement of instantaneous query execution times forms our
major bottleneck. I planned to partition this table, but I learnt that
PostgreSQL doesn't allow referencing views. Does anybody have any
suggestions?


Regards.


Re: Partitioning and Foreign Keys

From
Vivek Khera
Date:
On Nov 4, 2007, at 12:57 PM, Volkan YAZICI wrote:

> major bottleneck. I planned to partition this table, but I learnt that
> PostgreSQL doesn't allow referencing views. Does anybody have any
> suggestions?
>

I can envision writing your own custom trigger instead of using the  
stock FK trigger that knows which sub-table to check for the FK  
reference.   Then add that as an insert/update trigger on your  
referencing table.

I will be investigating this approach in the next few months; right  
now I don't have need for this particular case.