Is it OK to use multi-thread in Postgresql extension?
0
votes
1
answer
893
views
I'd like to improve performance of a Postgresql extension and certainly multi-thread is considered. While roughly, I know so far Postgresql is multi-process based, and in the extension, Postgresql things like SRF_FIRSTCALL_INIT(), SRF_PERCALL_SETUP, MemoryContextSwitchTo(), CreateTemplateTupleDesc(), palloc(), Int64GetDatum and so on are used, so my questions:
- Are above APIs thread-safe?
- Is it OK to use multi-thread in
Postgresql extension? If so, would you provide any example, or
provide any suggestion?
- Is there any multiple process framework is
actually preferable for extension? Like LaunchParallelWorker() and RegisterBackgroundWorker(), are they applicable for extension?
- Is there any method to perform something in parallel in extension?
Asked by Qiu Yangfan
(157 rep)
Sep 21, 2023, 03:16 AM
Last activity: Sep 21, 2023, 12:47 PM
Last activity: Sep 21, 2023, 12:47 PM