From: Michael Paquier <michael.paquier@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Qiu Xiafei <qiuxiafei@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Is is safe to use SPI in multiple threads?
Date: Sat, 10 Dec 2016 07:56:55 +0900
Message-ID: <20161209225655.GA1553@paquier.xyz> (raw)
In-Reply-To: <20161209223758.fkueb6bwiszmuatv@alap3.anarazel.de>
References: <CA+ag+4PGWbnHQx35Hswmd0aeMg8LkH5HTwApPtEwuGv=EJKUXA@mail.gmail.com>
<20161209223758.fkueb6bwiszmuatv@alap3.anarazel.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: michael.paquier@gmail.com, andres@anarazel.de, qiuxiafei@gmail.com
Subject: Re: Is is safe to use SPI in multiple threads?
In-Reply-To: <20161209225655.GA1553@paquier.xyz>
References: <CA+ag+4PGWbnHQx35Hswmd0aeMg8LkH5HTwApPtEwuGv=EJKUXA@mail.gmail.com> <20161209223758.fkueb6bwiszmuatv@alap3.anarazel.de> <20161209225655.GA1553@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox