Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id BCC8B1337B5D for ; Wed, 2 Feb 2011 14:59:01 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 14530-06 for ; Wed, 2 Feb 2011 18:58:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mail.postgresql.org (Postfix) with ESMTP id A991B1337999 for ; Wed, 2 Feb 2011 14:58:53 -0400 (AST) Received: from [192.168.1.6] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Ls7Sx-1QAAsN0ABT-013xFX; Wed, 02 Feb 2011 19:58:52 +0100 Message-ID: <4D49A968.3020800@2ndquadrant.com> Date: Wed, 02 Feb 2011 13:58:48 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Nikolas Everett CC: pgsql-performance@postgresql.org Subject: Re: Exhaustive list of what takes what locks References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:XoVZeE9PbQ8K5JTot52iVOiDsUU/BsOBWlNjTzTvAlg 02wTqL2GnItp3WwuORKHLAN73MRy0G+dDj+AQbajySegN+D3mJ bE1z6msGJoQn2mOCwtVDqJXBVHWdy/UJxWNl6Ki+YSQkatzg06 S50ImrBLzq6PVBtBpYqiRD+KpPpQu+XmKf/oPv0pEnzdSq6n7p 551hCFoldLyRdm7hg1MB1ScaBRPBE5JeCXssE4IQMc= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201102/36 X-Sequence-Number: 42174 Nikolas Everett wrote: > Is there an exhaustive list of what takes what locks and how long they > last? I'm asking because we just had some trouble doing a hot db > change to an 8.3.6 system. I know it is an old version but it is what > I have to work with. There haven't been any major changes in this area since then, it wouldn't really matter if you were on a newer version. The short answer to your question is that no, there is no such list. The documentation at http://www.postgresql.org/docs/current/interactive/explicit-locking.html and http://www.postgresql.org/docs/current/interactive/view-pg-locks.html are unfortunately as good as it gets right now. The subject is a bit more complicated even than it appears at first, given that you don't just need to take into account what statement is executing. You need to know things like whether any foreign keys are involved as well as what index type is used (see http://www.postgresql.org/docs/current/interactive/locking-indexes.html ) to fully predict what the locking situation for your SQL is going to become. It's a fairly big grid of things to take into account. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books