Re: unreferenced primary keys: garbage collection

Поиск
Список
Период
Сортировка
От Albert REINER
Тема Re: unreferenced primary keys: garbage collection
Дата
Msg-id 20010124203639.A203@frithjof
обсуждение исходный текст
Ответ на Re: unreferenced primary keys: garbage collection  (Michael Fork <mfork@toledolink.com>)
Список pgsql-sql
> On Tue, 23 Jan 2001, Forest Wilkinson wrote:
> 
> > Jan,
> > 
> > Thanks for the reply, but your solution is rather unattractive to me.  It
> > requires that, any time a reference to an address id is changed, five
> > tables be searched for the address id.  This will create unwanted overhead

If - and I think this is the case for you - it is no problem for you
to have some superfluous adresses in your tables, but you only want to
avoid that those adresses remain there for a long time, you could
simply run the function Jan sent from a cron job. That seems to be
likely to be more efficient not only than the triggers but also to the
ON DELETE RESTRICT solution, I guess.

Trivial, but I HTH -

Albert.


> > Forest Wilkinson wrote:
> > >> > I have a database in which five separate tables may (or may not) reference
> > >> > any given row in a table of postal addresses.  I am using the primary /
> > >> > foreign key support in postgres 7 to represent these references.
> > >> >
> > >> > My problem is that, any time a reference is removed (either by deleting or
> > >> > updating a row in one of the five referencing tables), no garbage
> > >> > collection is being performed on the address table.  That is, when the
> > >> > last reference to an address record goes away, the record is not removed
> > >> > from the address table.  Over time, my database will fill up with
> > >> > abandoned address records.

-- 

--------------------------------------------------------------------------
Albert Reiner                                   <areiner@tph.tuwien.ac.at>
Deutsch       *       English       *       Esperanto       *       Latine
--------------------------------------------------------------------------


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

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: Rule not invoked in 7.1
Следующее
От: Kyle
Дата:
Сообщение: Re: Rule not invoked in 7.1