X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 82900329DD0; Mon, 13 Sep 2004 21:02:09 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22476-03; Mon, 13 Sep 2004 20:02:03 +0000 (GMT) Received: from mr2.surnet.cl (av2.surnet.cl [216.155.73.169]) by svr1.postgresql.org (Postfix) with ESMTP id 50CB1329DC4; Mon, 13 Sep 2004 21:02:03 +0100 (BST) Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.024) id 413E2E55000E57C8; Mon, 13 Sep 2004 15:59:43 -0400 Received: from av2.surnet.cl ([216.155.73.169]) by smtp2.surnet.cl (MailMonitor for SMTP v1.2.2 ) ; Mon, 13 Sep 2004 15:59:42 -0400 (CLT) Received: from cluster.surnet.cl (216.155.73.165) by smtp2.surnet.cl (7.0.024) id 413E2E53000B3931; Mon, 13 Sep 2004 15:59:42 -0400 Received: from 216.155.88.75.dsl.surnet.cl (216.155.86.165) by cluster.surnet.cl (7.0.024) (authenticated as alvherre@surnet.cl) id 4134D3220016C513; Mon, 13 Sep 2004 16:01:58 -0400 Received: by 216.155.88.75.dsl.surnet.cl (Postfix, from userid 500) id DD0346EDC; Mon, 13 Sep 2004 16:02:25 -0400 (CLT) Date: Mon, 13 Sep 2004 16:02:25 -0400 From: Alvaro Herrera To: Merlin Moncure Cc: pgsql-hackers@postgresql.org, pgsql-docs@postgresql.org Subject: Re: [HACKERS] pg_locks view and user locks Message-ID: <20040913200225.GA5061@dcc.uchile.cl> References: <6EE64EF3AB31D5448D0007DD34EEB3412A74A8@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A74A8@Herge.rcsinc.local> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_DSBL X-Spam-Level: * X-Archive-Number: 200409/25 X-Sequence-Number: 2544 On Mon, Sep 13, 2004 at 01:34:05PM -0400, Merlin Moncure wrote: > First, the pg_locks view lists user level locks but doesn't really say > much about them. For example, for traditional locks we get the xid but > for user locks we don't really get anything useful. I looked in > lockfuncs.c and didn't see that there would be any real penalty to > displaying the offset/block of the user lock, and returning it in > request from pg_locks. ISTM it would be better to have pg_locks show only system locks, and another view, say pg_userlocks, to show user locks. This would allow to show different data; for example, the PID of the process involved. What's more, user locks and system locks never conflict, so it seems wrong to show them together. Another option would be to add another column to pg_locks to say what lockmethod (1 for system, 2 for user) is used in each lock. Maybe we want to separate locks even more, and use one table to show xact locks, another to show table locks, and yet another to show user locks. But maybe this is a bad idea right from the start. > Is this view frequently queried by system processes? I don't think there is a lot of server-side stuff (aside from possible UDFs) that use pg_locks directly. It's there only for user convenience. -- Alvaro Herrera () "Someone said that it is at least an order of magnitude more work to do production software than a prototype. I think he is wrong by at least an order of magnitude." (Brian Kernighan)