Re: background triggers? - Mailing list pgsql-general

From Rafal Pietrak
Subject Re: background triggers?
Date
Msg-id 1148586123.20217.376.camel@model.home.waw.pl
Whole thread Raw
In response to Re: background triggers?  ("Dawid Kuroczko" <qnex42@gmail.com>)
List pgsql-general
On Thu, 2006-05-25 at 20:27 +0200, Dawid Kuroczko wrote:
> On 5/25/06, Rafal Pietrak <rafal@zorro.isa-geek.com> wrote:
> > Here I'm just not interested in that procedure outcome: if it eventually
> > COMMITED or ROLLED-BACK. But obviously I am interested in consistancy of
> > database, when the detached procedure COMMITS.
>
> Hmm.  How are you going to get it?  No, an "on ROLLBACK" trigger is not
> a good idea! :-)

good point. But no. I was just to quick with typeing. I meant 'basically
interested', that is I'd like to relay on COMMITs guaranee of consistant
database. But I don't have to see that guarantee on every COMMIT. I'd
prefere to trust the database on that.

trigger on ROLLBACK ..... now, that's bizzare.

> > I mean. It looks like this is *really* a novelty for RDBMS design - I
> > feel, that real programmers here (you guys :) are so hard to persuade
> > its necesary, because it's so far from the 'synchronous nature' of
> > clasical RDBMS design and triggers in particular.
>
> Don't get me wrong, but a word "bizzarre" is more suitable than

OK. agree :)

> You said that your scheme would implement exclusive locking.

No. never mentioned locking. Not me.

> Well, if I were writing such an application, I would rather want such
> code to be fired not more frequently than 1 minute.
> ON COMMIT DETACHED WITH MINIMUM DELAY '1 minute'::interval; ? :-)

sweet. But there are issues.

In cases when the main traffic (keep in ming a nnumerous concurent
batches of INSERTS) does not rest for a single second, the above would
probably delay the agregare UPDATES indefinitely. Which may not
neceserly be appropriate. So there should be an indication, whether to
wait for 1 minute idle-time between INSERTS (foreground/main), or 1
minute idle-time between UPDATES (background/trigger).

Still, very, very desirable.

> Actually, I like the idea of "ON COMMIT" trigger (though without the
> "DETACHED" part), but this is another story...

By now, I like it even more then the initial 1) 2) 3) 4) scenario :) ...
but the DETACHED is vital.

regards,

-R

pgsql-general by date:

Previous
From: "Florian G. Pflug"
Date:
Subject: Re: background triggers?
Next
From: David Wall
Date:
Subject: reindexdb program error under PG 8.1.3