Documentation
¶
Overview ¶
Command pqlisten is a self-contained Go program which uses the LISTEN / NOTIFY mechanism to avoid polling the database while waiting for more work to arrive.
You can see the program in action by defining a function similar to the following:
CREATE OR REPLACE FUNCTION public.get_work()
RETURNS bigint
LANGUAGE sql
AS $$
SELECT CASE WHEN random() >= 0.2 THEN int8 '1' END
$$
;
Click to show internal directories.
Click to hide internal directories.