NOTIFY and pg_notify performance when deduplicating notifications - Mailing list pgsql-hackers

From
Subject NOTIFY and pg_notify performance when deduplicating notifications
Date
Msg-id 054001d45a74$23960f10$6ac22d30$@jdemoor.com
Whole thread Raw
Responses Re: NOTIFY and pg_notify performance when deduplicating notifications  (Catalin Iacob <iacobcatalin@gmail.com>)
List pgsql-hackers
Hi,

Back in 2016 a patch was proposed to fix the O(N^2) performance on transactions that generate many notifications. The
performanceissue is caused by the check for duplicate notifications. 

I have a feature built around LISTEN / NOTIFY that works perfectly well, except for the enormous performance impact to
transactionsthat emit large numbers of notifications. It’s very hard to work around the problem on the application side
andtransactions that could take just a few seconds end up taking over 30 minutes.  

The patch that was proposed was nearly finalized, but ended up being abandoned. The latest patch is here:
https://www.postgresql.org/message-id/CAP_rwwmKjO_p3kYB4jYceqcvcyRYjBQdji1GSCyqvLK%3D5nZzWQ%40mail.gmail.com.  

I understand that the only work left to be done on the patch was to address comments made on the proposed syntax. I’m
attachingan updated patch that changes the syntax to allow for a variable number of modes. The new syntax would be
NOTIFYchannel [ , payload [ , collapse_mode ] ] ; where collapse_mode can be 'never' or 'maybe'. 

I hope this patch can be reviewed and included in PostgreSQL.

Best regards.

--
Julien Demoor


Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cygwin linking rules
Next
From: Tom Lane
Date:
Subject: Re: Cygwin linking rules