Re: [GENERAL] About dropped notifications

2005-08-30 Thread Greg Stark

CSN [EMAIL PROTECTED] writes:

 I'm considering setting up a script that listens for
 notifications for a table and if a row is deleted the
 script will delete that row's corresponding files. 

One way to deal with this would be to have a boolean flag in the table like
deleted. Update that flag to true, and have a partial index where deleted.

Then your daemon can quickly query select file_name where deleted, process
the files and actually complete the deletion. All your other queries need to
test where not deleted or go through a view with a clause like that.

-- 
greg


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] About dropped notifications

2005-08-29 Thread Tom Lane
CSN [EMAIL PROTECTED] writes:
 I'm considering setting up a script that listens for
 notifications for a table and if a row is deleted the
 script will delete that row's corresponding files. If
 there are thousands of rows in the table, and I do
 delete from table, or even delete from table where
 id 1000 and id2000, will the script be notified of
 the deletion of each and every row (and subsequently
 be able to delete that row's files), or will only one
 notify event be received (or some number less than the
 actual number of rows deleted)?

Depends where you are doing the notify from ... but I think
with the current implementation, a transaction will emit only
one notify per notify event name, even if NOTIFY is executed
many times within the transaction.

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] About dropped notifications

2005-08-29 Thread Chris Browne
[EMAIL PROTECTED] (Tom Lane) writes:
 CSN [EMAIL PROTECTED] writes:
 I'm considering setting up a script that listens for
 notifications for a table and if a row is deleted the
 script will delete that row's corresponding files. If
 there are thousands of rows in the table, and I do
 delete from table, or even delete from table where
 id 1000 and id2000, will the script be notified of
 the deletion of each and every row (and subsequently
 be able to delete that row's files), or will only one
 notify event be received (or some number less than the
 actual number of rows deleted)?

 Depends where you are doing the notify from ... but I think
 with the current implementation, a transaction will emit only
 one notify per notify event name, even if NOTIFY is executed
 many times within the transaction.

An interesting question is whether or not the relevant tuple in
pg_listener gets invalidated once, or whether doing 2500 attempted
NOTIFY requests blows through 2500 copies.
-- 
cbbrowne,@,cbbrowne.com
http://www.ntlug.org/~cbbrowne/internet.html
As  long as  each  individual is  facing  the TV  tube alone,  formal
freedom poses no threat to privilege.  --Noam Chomsky

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [GENERAL] About dropped notifications

2005-08-29 Thread Tom Lane
Chris Browne [EMAIL PROTECTED] writes:
 [EMAIL PROTECTED] (Tom Lane) writes:
 with the current implementation, a transaction will emit only
 one notify per notify event name, even if NOTIFY is executed
 many times within the transaction.

 An interesting question is whether or not the relevant tuple in
 pg_listener gets invalidated once, or whether doing 2500 attempted
 NOTIFY requests blows through 2500 copies.

Once.  (Per transaction...)

regards, tom lane

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org