Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t4EsQ-00H7jM-2p for pgsql-performance@arkaria.postgresql.org; Fri, 25 Oct 2024 07:36:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t4EsM-00Dhh9-RJ for pgsql-performance@arkaria.postgresql.org; Fri, 25 Oct 2024 07:36:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t4EsM-00Dhh1-H4 for pgsql-performance@lists.postgresql.org; Fri, 25 Oct 2024 07:36:50 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t4EsK-002sPq-Iw for pgsql-performance@lists.postgresql.org; Fri, 25 Oct 2024 07:36:50 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5cb6ca2a776so2232151a12.0 for ; Fri, 25 Oct 2024 00:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec.at; t=1729841807; x=1730446607; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=d2G/zXajUMiV65/NFCJw7gYDnmlttiB8pIAHnaLoakY=; b=TxImcJEvOs1RNv3adHR4owYQ7mpg6yaGKzTygzRbWajM5/OtR9ksINehJ56uWgnPng cZQG4rBmjKK29aPBk+XMoIg1gMkH8zYOTm/5cRAt8rd/k3icZSnIfAbPrmRMASkl56Z+ PhlwWGCND/7X8O7GjhFR4eU8KH72YZoDEZ9bA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729841807; x=1730446607; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=d2G/zXajUMiV65/NFCJw7gYDnmlttiB8pIAHnaLoakY=; b=jM9U+1qpGaGhjgG3tXTx29BuZHe/RmrwUNZ5sOBc8HWjTwKFAbpMipFvrTzqPa4vF9 Vh1VfnuGj2Uq6BYGUrZRwBuf9ZR3NjNWupwe7ALjM8sQ2en/Ze+f8wA/g99LuRxM/oTq LMC+5gtXpwbYZjNpX7EeQatod+8EhEq04pnE7jvZhnpkbX4h9pwuDomwgKWmQ2+rDXcp 1Bc4K+64hnxd6dvXkoTnnZTM2/N81ceEsgqyL3EAjWf5GbjSxkuy7DbnEJ50z16Q6HkC HC06xocIipHURkoWHf8UtQgEUZNYjXffsbUPSLCfIj0z6w9ReFPi/adY/bWlxnA5QjeL 9gTw== X-Forwarded-Encrypted: i=1; AJvYcCUK5ZMCcaVbEdcsDnlXh8QAn4f+dtzxca/hu1ytjl7Rrt6q04ka1trKK5Gn/Y9IcZrN1WNghq8gS5qsC5K/mSZRZA==@lists.postgresql.org X-Gm-Message-State: AOJu0YzO15DfrLVkD4zBnW43R5+ECEkRYSQRsouE559x7t15jKM9O5P5 Zud6GLi/WGBXOKytOK3119eXuciMhz1HwRGI6a+BxLNZ5MqUpaV+/lhjIivKlTk= X-Google-Smtp-Source: AGHT+IGU1jxYiXfFkIkxIwqzRLNXu2Zosz4cytdqK2NUSnp7fgfhL3FzdTAxGMwZThfgaLaTnH86pw== X-Received: by 2002:a05:6402:529b:b0:5c9:5bb0:72fe with SMTP id 4fb4d7f45d1cf-5cb8acc29d9mr7350826a12.15.1729841807471; Fri, 25 Oct 2024 00:36:47 -0700 (PDT) Received: from localhost.localdomain (86.73.73.85.static.otenet.gr. [85.73.73.86]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cbb62cb158sm328133a12.58.2024.10.25.00.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 00:36:47 -0700 (PDT) Message-ID: Subject: Re: lwlock:LockManager wait_events From: Laurenz Albe To: James Pang , pgsql-performance@lists.postgresql.org Date: Fri, 25 Oct 2024 10:36:45 +0300 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-2.fc40) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2024-10-25 at 14:36 +0800, James Pang wrote: > we faced into a lot of=C2=A0 lwlock:LockManager wait-events , all of thes= e queries=C2=A0are "select ..." , > there are other several session are doing DML, insert/update/delete on sa= me table. > Did these DML transactions holding "transactionid" and "tuple" lock block= ing=C2=A0"select" on lwlock:LockManager ? This is not about waiting for a lock. Rather, it means that very many sess= ions are trying to take a lock. They have to grab the lock manager to take a lock, and the= competition for that resource is the bottleneck. It is hard to say what is the root cause without further analysis, but very= often the cause is that you have too many connections to the database. Using an effe= ctive connection pool *might* solve that particular problem. Yours, Laurenz Albe