简体   繁体   中英

LISTEN/NOTIFY on AWS Aurora/postgres

I am hoping to implement a trigger that fires a notify on table change in PostgreSQL, but I am unable to find any definite answer to if it would work in a cluster.

Does PostgreSQL listen/notify work on AWS Aurora (both provisioned and serverless), and can I expect all clients to receive notifications regardless of what instance they are connected to?

If yes, are there any major performance concerns?

Thanks :)

The best AWS Documentation implies - YES, it does work

Specifically for Aurora Serverless, there is an advisory that "LISTEN/NOTIFY" is NOT RECOMMENDED. This implies that it's possible with Aurora Serverless but not advisable. It also implies that normal RDS LISTEN/NOTIFY does work and is ok to use.

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html

Currently, certain SQL queries and commands, such as cursors with hold (DECLARE name ... CURSOR WITH HOLD FOR query); session-level advisory locks; temporary relations; and asynchronous notifications (LISTEN, NOTIFY commands) prevent scaling and are not recommended

My own quick test on AWS shows - Yes, it does work

  1. Launch Instance with Public Access

在此处输入图片说明

...

在此处输入图片说明

  1. Allow Traffic

在此处输入图片说明

  1. Run command in dbeaver

在此处输入图片说明

Note: This test doesn't show a successful receipt of a notification. That will need a quick console application to test that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM