Re: Deleting vs foreign keys

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Deleting vs foreign keys
Дата
Msg-id 20051024233918.GA26633@winnie.fuhr.org
обсуждение исходный текст
Ответ на Deleting vs foreign keys  (WireSpot <wirespot@gmail.com>)
Ответы Re: Deleting vs foreign keys  (WireSpot <wirespot@gmail.com>)
Список pgsql-general
On Tue, Oct 25, 2005 at 12:59:27AM +0300, WireSpot wrote:
> I have an application that makes heavy use of foreign keys all over
> the tables. This is very nice since the data is very consistent. There
> also this "central" table which holds "sites" in it. A site pretty
> much is the crux of it all. Deleting a site will very precisely
> eliminate all data regarding it, since there's CASCADE on delete's
> everywhere.
>
> The only trouble I'm having is that the original developers apparently
> didn't account for large amounts of data. I'm starting to get a LOT of
> data in some tables, and nowadays deleting a site will take a
> disgusting amount of time (in the range of tens of minutes).

Are there indexes on the foreign key columns?  That is, given
the following example,

CREATE TABLE foo (id integer PRIMARY KEY);
CREATE TABLE bar (fooid integer NOT NULL REFERENCES foo ON DELETE CASCADE);

do you have an index on bar.fooid?  Also, do you regularly vacuum
and analyze the database?

--
Michael Fuhr

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Generic Q about max(id) vs ORDER BY ID DESC LIMIT 1
Следующее
От: "krishnaa sridharan"
Дата:
Сообщение: pl/pgsql help