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 1ulldQ-005F8y-8w for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Aug 2025 09:49:36 +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 1ulldO-006hUE-Nd for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Aug 2025 09:49:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ulldO-006hU6-Dv for pgsql-hackers@lists.postgresql.org; Tue, 12 Aug 2025 09:49:34 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ulldM-000APY-0G for pgsql-hackers@lists.postgresql.org; Tue, 12 Aug 2025 09:49:33 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-45a12b3f4b3so2842275e9.3 for ; Tue, 12 Aug 2025 02:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754992169; x=1755596969; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=tObiHjLLxkXJx93s6B+k18CRMrXkhxraAw6fAFzbvaU=; b=dK+Kb5OnpKMX+2ZThgyP/S08+M4PmqaBasq8Z3A4OZ5HY1lQNYonNBrYfh+S9vIzAt nZNGIG32LrM47F6Gh3Xh3suYyXSYEptmuRFTLcOR2jih0F6iX2ZWqqeATRf8Y3TIRR6Q 9nPQhPnKUyJxqGgu6nf+zGHDEy2+GyAKCPl98rSP35xQrVG/iC5u1RjnpI8lw7dwJHxK Nvu1nNsYyr3duumWw+kwbyDYORmy+2VhCTSzh/ttahLExAnUWyLCviXZC+sMEfni8nwS 0xUeafNiPtJYj12aSU3hCqLHG/5xkNFZlH5FQUvGxcNi8crqe2w9EyUH5uMDAQ7XKnw7 33jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754992169; x=1755596969; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tObiHjLLxkXJx93s6B+k18CRMrXkhxraAw6fAFzbvaU=; b=U05zXLOR0LO10GT9Ew32TMxFS/wsoNK7EuIt74W1Iw3uI5j1visuOMpjCm/pu0hd4Y 55aqlI24LcvdXZaa29rHL2Q881+2/d2DMTVOmPsboklaQ80MdSPvdsONSjI63lOLen+q SjBI9F+y0o7CJjUwmstqRmYtyNa/jh/Gnx5y9a7Jky2+Pi2fboNi8bTCnVl+RmyO7e3j khlaqOHw3ucfEZUfJDNV/pjV9rh65q/ikq7wz3NvK3T0BATd8OYhu6A223KUwLaUbPaW +5/xz2UeocWJA6FjWLhMyAwr38WdY+XSs7HWnMmQUZfpNRHTQq9PlVldFGekHfsQwoZy UAxw== X-Forwarded-Encrypted: i=1; AJvYcCXazDqiEiRZ/dq33gLFbDJGaEz2c15iPmY0qlmPTMPoH0BLIEd3bsZ55ARm6ehVb64Z808hSmyiw3frD7Bb@lists.postgresql.org X-Gm-Message-State: AOJu0YzKssC9QtseHFrNcdWR5AF9uqfmxNNPkG9HdINuL9J+8+7ztYPS ToU+8M4Dvd3kEA+fMg4Hjj7UaslOUQg2FPjbC+LEBXcR+eRTa7uBggGx X-Gm-Gg: ASbGncvznFjHOMSIuwKjsl3MBHGulSJK6OoJVE/xNnNzlYzhblVPdvALf+0DgxGeqJP uPzmcy/S7z/+NUW7CrbnocUsj835XyTwZPpQ4c9DrIXBnqdu4H12YMPTGIVMPofrUPtZeZv86Sq 2KxB8Yk8snISM5xisEuSfHcJqUy5x4p5lwIn5nZkB40FVfqiThVb3Ae5VKRRUVUfWwyNa0wGej2 ovswipvz+fYSuI5lSoQXYagX+OdMvVp1Sw7yCJj+bDEKKWdTtqaS9UJhK2HvyQgc021htoRYwvh 1ig/TL8YBbytH5ICxyXQ+roAacD0b4Cp5Pbxjho7U4Oxz04fSMa7IgsMlzq1N107EGvS6uWa3pz FjqndufcoWZ8EZ3lyrZU6O5EGSyJTMtptnu8LaWfP4cB62LHwbl06mtENFg+zER036xmn6fSqNX FTY31coRYbr4zSMFk/K5nexUd0w3Jr9QBUCFgps3BBnKzMCmOgalS+vQ== X-Google-Smtp-Source: AGHT+IEbrinduWDD2KbUJEmvpbNIWuNdu/7c5N0cxlabgcfHBmH2Z3TG7bCV2mxAHOllo0e5dl0+6w== X-Received: by 2002:a05:600c:4f14:b0:456:1156:e5f5 with SMTP id 5b1f17b1804b1-45a1178b93bmr20141425e9.31.1754992169220; Tue, 12 Aug 2025 02:49:29 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-181-182.eu-west-3.compute.amazonaws.com. [15.237.181.182]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm44532193f8f.34.2025.08.12.02.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Aug 2025 02:49:28 -0700 (PDT) Date: Tue, 12 Aug 2025 09:49:27 +0000 From: Bertrand Drouvot To: Tom Lane Cc: Michael Paquier , Jeff Davis , Greg Sabino Mullane , pgsql-hackers@lists.postgresql.org Subject: Re: Adding locks statistics Message-ID: References: <87c3170d0645cec732f0d7b2969c75db1b3c86c6.camel@j-davis.com> <3282672.1754956185@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3282672.1754956185@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Aug 11, 2025 at 07:49:45PM -0400, Tom Lane wrote: > Michael Paquier writes: > > On Mon, Aug 11, 2025 at 02:53:58PM -0700, Jeff Davis wrote: > >> Can you describe your use case? I'd like to understand whether this is > >> useful for users, hackers, or both. > > > This is a DBA feature, so the questions I'd ask myself are basically: > > - Is there any decision-making where these numbers would help? These > > decisions would shape in tweaking the configuration of the server or > > the application to as we move from a "bad" number trend to a "good" > > number trend. > > - What would be good numbers? In this case, most likely a threshold > > reached over a certain period of time. > > - Would these new stats overlap with similar statistics gathered in > > the system, creating duplication and bloat in the pgstats for no real > > gain? > > I'm also wondering why slicing the numbers in this particular way > (i.e., aggregating by locktype) is a helpful way to look at the data. > Maybe it's just what you want, but that's not obvious to me. Thanks for providing your thoughts! I thought it was more natural to aggregate by locktype because: - I think that matches how they are categorized in the doc (from a "wait event" point of view i.e "Wait Events of Type Lock"). - It provides a natural drill-down path, spot issues by locktype in the stats and then query pg_locks for specific objects when needed. Does that make sense to you? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com