On Fri, Jan 13, 2012 at 2:29 PM, Christopher Browne <cbbrowne@gmail.com> wrote:
> On Fri, Jan 13, 2012 at 3:14 PM, Frederico <zepfred@gmail.com> wrote:
>> Hi folks.
>>
>> Is there any restriction in create and start threads inside Postgres?
>>
>> I'm trying to develop a multithread planner, and some times is raised a exception of access memory.
>>
>> I'm debugging the code to see if is a bug in the planner, but until now, I still not found. I tried to use the same
memorycontext of root process and create a new context to each new thread, but doesn't worked.
>>
>>
>> Any tips?
>
> Yes, don't try to use threads.
>
>
<http://wiki.postgresql.org/wiki/Developer_FAQ#Why_don.27t_you_use_threads.2C_raw_devices.2C_async-I.2FO.2C_.3Cinsert_your_favorite_wizz-bang_feature_here.3E.3F>
>
> ... threads are not currently used instead of multiple processes for
> backends because:
Yes, but OP is proposing to use multiple threads inside the forked
execution process. That's a completely different beast. Many other
databases support parallel execution of a single query and it might
very well be better/easier to do that with threads.
merlin