On Mon, Nov 6, 2017 at 4:43 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > I wonder if we couldn't somehow repurpose the work that was done for > parallel workers' locks. Lots of security-type issues to be handled > if we're to open that up to clients, but maybe it's solvable. For > instance, maybe only allowing it to clients sharing the same snapshot > would help.
Interesting idea. There's a bunch of holes that would need to be patched there; for instance, you can't have one session running DDL while somebody else has AccessShareLock. Parallel query relies on the parallel-mode restrictions to prevent that kind of thing from happening, but it would be strange (and likely somewhat broken) to try to enforce those here. It would be strange and probably bad if LOCK TABLE a; LOCK TABLE b in one session and LOCK TABLE b; LOCK TABLE a in another session failed to deadlock. In short, there's a big difference between a single session using multiple processes and multiple closely coordinated sessions. Also, even if you did it, you still need a lot of PROCLOCKs. Workers don't need to take all locks up front because they can be assured of getting them later, but they've still got to lock the objects they actually want to access. Group locking aims to prevent deadlocks between cooperating processes; it is not a license to skip locking altogether. None of which is to say that the problems don't feel related somehow. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers