Re: One process per session lack of sharing - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: One process per session lack of sharing
Date
Msg-id CAMsr+YGDw2O9mftFQn-3QO6=3R2iJXtq+EO4hQMpK_Z0V5FftQ@mail.gmail.com
Whole thread Raw
In response to Re: One process per session lack of sharing  (AMatveev@bitec.ru)
Responses Re: One process per session lack of sharing  (AMatveev@bitec.ru)
Re: One process per session lack of sharing  (james <james@mansionfamily.plus.com>)
Re: One process per session lack of sharing  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 14 July 2016 at 16:41, <AMatveev@bitec.ru> wrote:
Hi

> On Tue, Jul 12, 2016 at 9:18 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> AMatveev@bitec.ru writes:
>>> Is  there  any  plan  to  implement  "session  per  thread" or "shared
>>> sessions between thread"?
>>...
>> so
>> there's not that much motivation to do a ton of work inside the database
>> to solve it there.

> I agree that there's not really a plan to implement this, but I don't
> ...

> So, I actually think it would be a good idea to think about this.

I just want to note that converting global variables to  thread-specific variables.

I don't think anyone's considering moving from multi-processing to multi-threading in PostgreSQL. I really, really like the protection that the shared-nothing-by-default process model gives us, among other things.

I'm personally not absolutely opposed to threading, but you'll find it hard to convince anyone it's worth the huge work required to ensure that everything in PostgreSQL is done thread-safely, adapt all our logic to handle thread IDs where we use process IDs, etc. It'd be a massive amount of work for no practical gain for most users, and a huge reliability loss in the short to medium term as we ironed out all the bugs.

Where I agreed with you, and where I think Robert sounded like he was agreeing, was that our current design where we have one executor per user sessions and can't suspend/resume sessions is problematic.
 
It's large work offcourse.
But it's not seemed to be a ton of work.

Er.... yeah, it really is. It's not just the mechanical changes. It's verifying that everything's correct on all the supported platforms. Ensuring that all the C library stuff we do is thread-safe, all the SSL stuff, etc. Getting rid of all the function-static variable use. Lots more.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: sslmode=require fallback
Next
From: Andreas 'ads' Scherbaum
Date:
Subject: Re: sslmode=require fallback