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 1uFXNk-005ZVc-6a for pgsql-performance@arkaria.postgresql.org; Thu, 15 May 2025 12:08:12 +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 1uFXNi-00E751-M1 for pgsql-performance@arkaria.postgresql.org; Thu, 15 May 2025 12:08:10 +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 1uFXNi-00E74r-Ay for pgsql-performance@lists.postgresql.org; Thu, 15 May 2025 12:08:10 +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.96) (envelope-from ) id 1uFXNf-0021WE-0J for pgsql-performance@lists.postgresql.org; Thu, 15 May 2025 12:08:09 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5fcac09313cso1404809a12.2 for ; Thu, 15 May 2025 05:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1747310886; x=1747915686; 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=roN2e20UG9xORhsBlKi1SzIVyCUZYSXAjIClPdIB+g4=; b=YytVgTVxhWBcB3k1gKqs+0xEo3+G5YtqApiTeGwUBG2SnYqHx+J4kMSomMFhHJMC/C u4Lh+MY+FKG72UGjVWR8eA4uWyI1CRYiHX96dsuYpg0pprKP0QFFNGgMdXD7B+//CqKW wMWdyuYfH6bsr/OuvpEU5OIwl8hZgSmlxwdARqWOpcSUS0HkD4czY2i/BYLdU9NWavsk hQo8biZCzPA+AquwiGq67XshHQKPVNTthMco3Wc7NwAl19/RcEZNz/WSjzxt4xqADDcj Ucz2mtRdVZoeY9U2ZX0y4631SZFM7+0ObUt4NrC8WcJmTyxoap6Kxid85clW3x81hfHK 3VSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747310886; x=1747915686; 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=roN2e20UG9xORhsBlKi1SzIVyCUZYSXAjIClPdIB+g4=; b=S5om1DpuXajG/zNaj11/q2zhN7pFfFcNKDhE/VcL7qIZW/pVxilIJNXScJ1807NNNM JqU9x4OSEHmPtPejWciUmyVPmmWK+H0ka1l8EmZw7YvinRfJ82tGNb3MqmKuvoJEwI17 oSNN1BkwJot9M/qsMErTz8wW3dj7mXjVPkfq2cha0HCSSLCvdrOHeXOk9D+BnC9WlOUK I86FjdQ1wHalAJ00O0FLH/YAp055AyRYD7QmPVZJISIlYTrRWI54RX3fq/StrI1djsse eY+RYDSVXP917byDOL+cnA0RKyrz/Ov82dknLlzt1Gre/9Hrw/7tfqU93WND/4DdesrL Vtgg== X-Forwarded-Encrypted: i=1; AJvYcCUljwNlNysi7B2OhtQM4BvECfN7g/snYZZIJOHEdDowSzrkb5lAfM6TidyUbNLPQVqVnTx3OsNfnTSYNsZoWWT5DQ==@lists.postgresql.org X-Gm-Message-State: AOJu0YwCUEgFDLFWpivW24aEi5qsRNtHG1YZWzwg0/1QXSeftS69d2b9 OvvOFsSOrdW4U5Ym4/tv+ac2j2AVMabNN6Aq7hY8LB29SuKBMoKH011BpUzlruk= X-Gm-Gg: ASbGncvpwnQp2uWjyMLjCZrkUpFoKPqQVKNnUvj0hMjYuWyLoOGcN55WeEmMRQelXd9 3cp2jeuj7Xo+SBP8AaWxSZFhbJ+prcmfKpb5SAVyHa1YhpdM0XU0OFdCUHXpe0Zg5aMpKJXVE+k iPpFP1deZu/idaLungZbzMeQviA5ekA/TMc03UhBsWYnqz/qvUqmhRCS4fnzQAb8FZJ3fOfHyEW TcWf7uz2qPK6UQGF+NTNgumHYqlXocpBoQk3uHsHRsrUnn2ciJNmZm5WJ0RNiSxqDAnb9/m88Tx 18y86RnBLEb/Bn+z2Ta1B9DjhVVDueuYQBnxqYObZ2L+94mahMshuht2mV3VDPgOwuS/s+HqhXI L0ksF X-Google-Smtp-Source: AGHT+IEeHWSOSKfMO4Y7DUDrPNzzdJPX/EKlE1I6eU0W7PC+VgWkd7rLbCY3ZrVo9ASIK6a32+lDCg== X-Received: by 2002:a17:906:478b:b0:ad2:3f54:1834 with SMTP id a640c23a62f3a-ad51601efabmr221089166b.40.1747310886046; Thu, 15 May 2025 05:08:06 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:5e:8636:6efd:7453:bbcf:999c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad2192c8f98sm1118601966b.10.2025.05.15.05.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 May 2025 05:08:05 -0700 (PDT) Message-ID: <54994813530a36c0280fd8779e65ad1ad73d910a.camel@cybertec.at> Subject: Re: a lot of session wait on lock relation From: Laurenz Albe To: James Pang , pgsql-performance@lists.postgresql.org Date: Thu, 15 May 2025 14:08:05 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.1 (3.56.1-1.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-05-15 at 16:27 +0800, James Pang wrote: > PGv 15.10,=C2=A0 many session coming in doing "insert into tablexxx value= s...." in parallel, > this is a range partition tables, total 12 partitions plus one default pa= rtition, > only three btree indexes, no others constraints ,no foreign key. but we s= ee hundreds > of session waiting on "lock:relation", why inserts into partition table c= ause "relation lock" ? Something else does; use the pg_blocking_pids() function with the process I= D of a blocked backend to find out who is holding the lock. If you have hundreds of sessions, you are allowing to many connections. Yours, Laurenz Albe