Re: group locking: incomplete patch, just for discussion

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: group locking: incomplete patch, just for discussion
Date: 2014-11-01 21:09:17
Message-ID: CA+Tgmob43DgO4ZM2nLbvVoLHCyna6nsbXPLHtEBUodQyybhsgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 1, 2014 at 1:09 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> What are the specific restrictions you are suggesting we place on
> parallel workers? We need that definition clear so we can decide how
> to mark the functions. If we don't know, which is easily
> understandable, then the best way to find that out is to build a
> restricted solution and to expand slowly outwards to find problems.
>
> An obvious milestone there is whether a function contains SQL, which
> is the point chosen by some other databases. I personally hope to
> expand upon that, but it would be useful to reach it first and then
> continue from there.
>
> I was already thinking of implementing CONTAINS NO SQL as a SQL
> Standard function marking since it can be used to optimize COPY
> further.

I've written some fairly extensive thoughts on this topic at
http://wiki.postgresql.org/wiki/Parallel_Sort

Personally, I tend to focus more on what needs to be allowed in
parallel workers than what needs to be prohibited. The motivation for
this patch is simple:

1. Any non-trivial piece of PostgreSQL code is likely to contain
syscache lookups.
2. Syscache lookups had better work in parallel workers, or they'll be
all but useless.
3. Some of those syscache lookups will be satisfied from cache, but
sometimes we'll need to actually read the system catalogs.
4. That requires locks.
5. Gosh, we'd better not deadlock.

There's a lot of infrastructure that I think will work fine in
parallel mode without any changes. Buffer locking, buffer pins,
buffer lookups, and lwlocks, for example, I expect to all just work
without any real. But heavyweight locks and invalidation messages
seem like they'll need a bit of surgery to work correctly in this
environment.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-11-01 21:09:59 Re: group locking: incomplete patch, just for discussion
Previous Message Andres Freund 2014-11-01 21:06:41 Re: group locking: incomplete patch, just for discussion