Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fqN8V-0003Li-5O for pgsql-performance@arkaria.postgresql.org; Thu, 16 Aug 2018 18:36:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fqN8T-0008PR-IQ for pgsql-performance@arkaria.postgresql.org; Thu, 16 Aug 2018 18:36:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fqN8T-0008PK-7d for pgsql-performance@lists.postgresql.org; Thu, 16 Aug 2018 18:36:41 +0000 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fqN8Q-0003lu-1W for pgsql-performance@lists.postgresql.org; Thu, 16 Aug 2018 18:36:39 +0000 Received: by mail-qk0-x243.google.com with SMTP id w26-v6so47757qkf.4 for ; Thu, 16 Aug 2018 11:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=QJRRiT4bpbiyXSe3gEztVUT0mwQRd/mmetFO6lKo+Lw=; b=ZjKgTUIB4t34AbKKds45wWBL0HUejLywNSM76BrXGtwMyJgMYSomBgkSyZyaGzszhG ziNOlMfJXVLk5+MTqbUDfR+Kg4EpJdFpIQmmrtG8U7NtSS/QjrKNfSjXVQ3JffQ6nqnp wCVgqFxBHx9nPfw1no00Xoo7/Xv1EsNE35pgdVS7QyA4JZkDBnIkbF3LbrsgH/dQQxiV Fo6K9I3vrDQTTi3tFeXaeeQLBuYu+UMaI8tyq9/64omoNaUkkvbuWSYGbwkWmft/CnA1 Wv0t9kPHPrfmCHc4f1/7upHYIMThySwZd/8KVXUA28QxsLUPloZKgRyYDKI3wJwYc9w3 K9JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=QJRRiT4bpbiyXSe3gEztVUT0mwQRd/mmetFO6lKo+Lw=; b=W/TP9B81IbY0vBoQhT0iBL21mCyAnqGIdObbmIVzbBIWJX7L9sf99RYIYI9vYcw4+Z +BbteMZhNU1NsCuygQZ39mc8ge5tTneWoQWeciIP7YSZF974zbO+wCMxeOpkOtxaNNT0 arO0yY3yQYKUONO+S47YTAbTHd0/kXb2CRe7qkSGjgCETVz4i9G8xHruK4dUEOAatnyY 5PI5XoSOzmMQO4+mRzuW7DG/ck59woxvsr/MXJnuQu+hMvwWjhId8nmBiQQpQXEAZkk9 sJPqKR+d9cb0kWPPu4+sOUNTVGQrAI6Sq5iT/XElsRBLDABl7MR2Y+STTjX7BYG7CJEj fbKg== X-Gm-Message-State: AOUpUlF9XCTiSm+xAQG/RtLkM9RcjuOq3QEZPT+E5c9IrUA4CkyHauFd Vn8HcFoIHuaKZuCPVH+1LQVjFIK6qBM= X-Google-Smtp-Source: AA+uWPxtABgnR/gdYgUY+EeprV9haiAn0q4E1NEppIiWes71yE3EQOErI+tX+oqvgVZeyfcUrS/BTQ== X-Received: by 2002:a37:407:: with SMTP id 7-v6mr4466869qke.116.1534444596085; Thu, 16 Aug 2018 11:36:36 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id u129-v6sm15136qkd.45.2018.08.16.11.36.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Aug 2018 11:36:35 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 4370F6D8; Thu, 16 Aug 2018 15:36:32 -0300 (-03) Date: Thu, 16 Aug 2018 15:36:32 -0300 From: Alvaro Herrera To: Fred Habash Cc: pgsql-performance@lists.postgresql.org Subject: Re: Guideline To Resolve LWLock:SubtransControlLock Message-ID: <20180816183632.lo34je5dudbros4a@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-Aug-16, Fred Habash wrote: > One of our database API's is run concurrently by near 40 sessions. We see > all of them waiting back and forth on this wait state. What version are you running? > Why is it called Subtrans Control Lock? It controls access to the pg_subtrans structure, which is used to record parent/child transaction relationships (as you say, savepoints and EXCEPTIONs in plpgsql are the most common uses, but not the only ones). Normally lookup of these is optimized away, but once you cross a threshold it cannot any longer. > What are the common user session scenarios causing this wait? > - I have read some describe the use of SQL savepoints or PL/pgSQL > exception handling. > What are known resolution measures? Are you in a position to recompile Postgres? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services