Florian G. Pflug wrote:
> Hi
>
> I ran into some performance problems regarding foreign keys lately.
> My schema has about 20 tables, which each contain from 10 to 100.000
> records. They have quite complicated interdependencies, modeled using
> foregin keys set to "on update cascade, on delete cascade".
> The schema stores data for multiple customers - Recently I wanted
> to extract the data for just a single customer. I duplicated the schema,
> and deleted all but one customer from the "customer" table. This worked
> as expected, but the delete took a few hours (!) on a moderatly fast
> machine (dual 1GHz PIII, RAID5-Array for postgres-data).
PostgreSQL doesn't automatically add indexes to foreign-key columns.
That sounds like the issue to me.
--
Richard Huxton
Archonet Ltd