Re: Is is safe to use SPI in multiple threads?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Qiu Xiafei <qiuxiafei(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Is is safe to use SPI in multiple threads?
Date: 2016-12-09 22:56:55
Message-ID: 20161209225655.GA1553@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Dec 09, 2016 at 02:37:58PM -0800, Andres Freund wrote:
> On 2016-12-09 16:52:05 +0800, Qiu Xiafei wrote:
> > 1. Is there a way to use SPI in multi-thread style?
>
> No.
>
> > 2. Another option is to use libpq, like normal clients do. Is libpq as
> > efficient as SPI?
>
> No.

To give more details here, Postgres relies heavily on the fact that sessions
working in parallel on the backend should be done in separate processes,
like for transaction or snapshot handling.
--
Michael

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Samuel Williams 2016-12-09 23:40:56 Re: Index size
Previous Message Andres Freund 2016-12-09 22:37:58 Re: Is is safe to use SPI in multiple threads?