Re: Background Processes in Postgres Extension

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sushrut Shivaswamy <sushrut(dot)shivaswamy(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Background Processes in Postgres Extension
Date: 2024-04-23 15:59:27
Message-ID: 3384911.1713887967@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sushrut Shivaswamy <sushrut(dot)shivaswamy(at)gmail(dot)com> writes:
> I'm developing a postgres extension as a custom Table Interface method
> definition.
> WIthin the extension, I"m planning to create two background processes using
> `fork()` that will process data in the background.

> Are there any recommendations / guidelines around creating background
> processes within extensions in postgres?

fork() is entirely the wrong way to do it, mainly because when the
creating session exits the postmaster will be unaware of those
now-disconnected child processes. See the mechanisms for creating
background worker processes (start with bgworker.h).

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-04-23 16:02:07 Re: Popcount optimization using AVX512
Previous Message Tom Lane 2024-04-23 15:53:21 Re: slightly misleading Error message in guc.c