Usage¶
To make your extension use the interface, include the header file and declare magic signature:
Allocating shared memory¶
You can request shared memory in _Dynpgext_init
callback you can define:
Shared memory allocation | |
---|---|
A particularly useful feature is the ability to scope the allocation per database so that every database provisioned will get its own allocation of the specified size.
Once allocated, the pointer to allocated memory can be found using dynpgext_lookup_shmem(name)
:
Registering background worker¶
You can register a background worker to be started in `_Dynpgext_init:
Just like shared memory allocations, background workers can be either global or provisioned per database.
Caveat: bgw_restart_time is always BGW_NEVER_RESTART
Since omni_ext manages the startup of the background workers,
BackgroundWorker.bgw_restart_time
value is ignored and is always
effectively set to BGW_NEVER_RESTART
so that Postgres never attempts
to restart them itself.