Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id C9CA717B105B for ; Fri, 11 May 2012 10:53:13 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SSqHQ-0002SU-Vt for pgsql-bugs@postgresql.org; Fri, 11 May 2012 13:53:13 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q4BDqwqE002942; Fri, 11 May 2012 09:52:58 -0400 (EDT) To: Heikki Linnakangas cc: Ryan Kelly , tom Tom , pgsql-bugs@postgresql.org Subject: Re: BUG #6629: Creating a gist index fails with "too many LWLocks taken" In-reply-to: <4FACE4C7.6070306@enterprisedb.com> References: <4FA7EC37.5070703@enterprisedb.com> <20120508011540.GA28140@llserver.lakeliving.com> <4FACE4C7.6070306@enterprisedb.com> Comments: In-reply-to Heikki Linnakangas message dated "Fri, 11 May 2012 13:07:03 +0300" Date: Fri, 11 May 2012 09:52:57 -0400 Message-ID: <2941.1336744377@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/60 X-Sequence-Number: 33031 Heikki Linnakangas writes: > I wonder if we should reserve a few of the lwlock "slots" for critical > sections, to make this less likely to happen. Not only in this case, but > in general. We haven't seen this problem often, but it would be quite > trivial to reserve a few slots. I'm against that: it would complicate a performance-critical and correctness-critical part of the code, in return for what exactly? IMO, no part of the system should ever get within an order of magnitude of holding 100 LWLocks concurrently. For one thing, I don't believe it's possible to statically guarantee no deadlock once things get that messy; and for another, it'd surely be horrible from a concurrency standpoint. So anytime we find something that's reaching that limit, the solution is to fix the lock usage, not to make the limit more forgiving. regards, tom lane