Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
PostgreSQL
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Asynchronous notifications === PostgreSQL provides an asynchronous messaging system that is accessed through the NOTIFY, LISTEN and UNLISTEN commands. A session can issue a NOTIFY command, along with the user-specified channel and an optional payload, to mark a particular event occurring. Other sessions are able to detect these events by issuing a LISTEN command, which can listen to a particular channel. This functionality can be used for a wide variety of purposes, such as letting other sessions know when a table has updated or for separate applications to detect when a particular action has been performed. Such a system prevents the need for continuous [[polling (computer science)|polling]] by applications to see if anything has yet changed, and reducing unnecessary overhead. Notifications are fully transactional, in that messages are not sent until the transaction they were sent from is committed. This eliminates the problem of messages being sent for an action being performed which is then rolled back. Many connectors for PostgreSQL provide support for this notification system (including libpq, JDBC, Npgsql, psycopg and node.js) so it can be used by external applications. PostgreSQL can act as an effective, persistent [[publish–subscribe pattern|"pub/sub" server]] or job server by combining LISTEN with FOR UPDATE SKIP LOCKED.<ref name="postgres-jobserver">{{cite web |last1=Chartier |first1=Colin |title=System design hack: Postgres is a great pub/sub & job server |url=https://layerci.com/blog/postgres-is-the-answer/ |website=LayerCI blog |date=November 8, 2019 |access-date=November 24, 2019}}</ref><ref name="release-9.5">{{cite web |title=Release 9.5 |url=https://www.postgresql.org/docs/9.5/release-9-5.html |website=postgresql.org|date=February 11, 2021 }}</ref><ref name="ringer-skip-locked">{{cite web |last1=Ringer |first1=Craig |title=What is SKIP LOCKED for in PostgreSQL 9.5? |url=https://www.2ndquadrant.com/en/blog/what-is-select-skip-locked-for-in-postgresql-9-5/ |website=2nd Quadrant |date=April 13, 2016 |access-date=November 24, 2019}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)