From: | Andreas Fromm <Andreas(dot)Fromm(at)physik(dot)uni-erlangen(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: deleting referenced data |
Date: | 2003-08-27 14:57:59 |
Message-ID: | 3F4CC6F7.9060603@physik.uni-erlangen.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Bruno Wolff III wrote:
>On Wed, Aug 27, 2003 at 00:09:34 +0200,
> Andreas Fromm <Andreas(dot)Fromm(at)physik(dot)uni-erlangen(dot)de> wrote:
>
>
>>Bruno Wolff III wrote:
>>
>>
>>
>>>On Tue, Aug 26, 2003 at 18:34:04 +0100,
>>>Richard Huxton <dev(at)archonet(dot)com> wrote:
>>>
>>>
>>>I don't think that is what he wants. He seems to want to go in the other
>>>direction. That is going to require custom triggers and probably adding a
>>>reference count column to data-tables.
>>>
>>>
>>>
>>>
>>This is what I want to do, but my question is how can I easely now if
>>there is someone referencing a certain record. Is it just possible by
>>searching every table that could reference it or is there an other way
>>of doing it without adding an reference count column?
>>
>>
>
>You can use a reference count in the row you are interested in. You
>would need to create triggers on all referncing tables to update the
>reference count as necessary. Also as pointed out previously, you
>want to use serialized isolation (and handle retries) or exclusively lock
>the table (and worry about deadlocks and a concurrency bottleneck)
>if you use this approach.
>
>You could do a scan of all possible referencing tables whenever you update
>any of the referencing tables. However, this approach has pretty much the
>same problems as using a refernce count and will probably be slower.
>
>
As the newbe I am, I don't understand much abaut serialized isolation,
db-locks and so on.
Do I need to care abaut all these considerng that the database will only
be accessed by one user at a time, and the hole db will not have many
entries?
Are there basic dessign considerations that should be taken, or is it
something that can be added in the future?
As I don't have much time to invest in this project, I will have to come
up with some other solution. Maybe something like a 'garbage collection'
routine, that runs over the db from time to time and delets all
unreferenced records.
--
Andreas Fromm
From | Date | Subject | |
---|---|---|---|
Next Message | Deepa K | 2003-08-27 15:02:30 | Arrays is stored procedure |
Previous Message | FernAndo | 2003-08-27 14:48:35 | process big |