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.96) (envelope-from ) id 1w6BeL-0042RI-2r for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 18:11:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6BeK-00BD8M-0n for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 18:11:12 +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.96) (envelope-from <9erthalion6@gmail.com>) id 1w6BeJ-00BD8B-34 for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2026 18:11:12 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from <9erthalion6@gmail.com>) id 1w6BeI-00000001MQ6-1e6A for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2026 18:11:11 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-66b51bfe5f3so1305445a12.2 for ; Fri, 27 Mar 2026 11:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774635069; x=1775239869; 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=cZu1gmhpQOLpwraMRdMyJ50pHFz5O2UTORAWDe9lgGI=; b=mbtp5dk71Y0bphRc5ld13H94dpXf88k+adYDhV+qHltRksaF6IBeoQZnio1H/oZIsq y+RFEWvGKwMXFNjY/0lg3qg0THPLTtHGaaz4vCXgDIYkIbIHAre9aTAhIFrBM3d4d2oJ XoN8B090ysfj6DY9CAKfnFPjQKkuQdqXqyqZLDOIygcJGq69cOZE/jYPu+eLzRoBFD3U ibNr0g4x2bC/LaeRn3Bk/gNB2u2eYeZS7684tNan26vA8Iuo9h2wWLhFJvo6CsJvqniE xtxZboIDsgmE4+LiJz8vt4j7S3tAIKvDUJoPD+2/mUA867lGtF0yKTq9XZ6nEA3mXg6R WSNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774635069; x=1775239869; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cZu1gmhpQOLpwraMRdMyJ50pHFz5O2UTORAWDe9lgGI=; b=qODB+QKB9hmiS8+PhE1eBlUi0d7tyai55RHR4E6YQ7KVrkXaVYxb9JwKaDHN5XDJgP XSpIEORmiw9dudMUuSjQulXTFwmMF/GDzqDY+5dWe9+L4bhf1edRJU0Y20AqLX6Zecld l1RwKvuLhL8ExvdPz40oaKN/lVUtcV/dUtiw/Z6cYHIPQHWSlWBNzi1/vEaROOlx/iLR 5DW27xPDxch40ZFaH56ZnMIl0WjMfM/aujslbSTnhPZnN9LrHjDdJK0MWMQjOGSXPvkw We9thFVAmyYAsMxjffZF11apomIyk6xxdisVlZq2BLHzKygiyqsiw1sCD8hptMG4Cm4i Btgg== X-Forwarded-Encrypted: i=1; AJvYcCVXEJ4EI3X2MmNTG6kru4ELqC+wnVVCiaubPulTObCl1RP7sUvQOqkogKNr+MxY3fWaZWTgdHr/kH5EAoqv@lists.postgresql.org X-Gm-Message-State: AOJu0YwBXkdj++H0t3PJaOVdt39L7ab/hYx5fZDjCu5r/WKs1wacuVXl Zdg2lI8tSE0QPzA1E/SVPGZQhcl1dIxHj/QSnCpp5wvVf9zcnEN0DmSH X-Gm-Gg: ATEYQzzGkmk3rmbURJREVxyKDpxPpep32bgLjEIvbjWJF7IZrq2LmkRPdcs6gZm+WD2 vqGMOlIT2NXRJByiegUcbxPwhxEZQo1xcs7jI/lqJi1EpUHdXM25If/vy+Yx0TXSeRqpSgqASC3 BNq9ZjKGT/dtdjRTasjqd7UvoVY3tygs7t4Q2HXny6g3ygX0jxkODF1JspJD7B7A9nyCyEGqyC+ kyfBpsaIcKXURCptwvg/5IuqjookcUm5GxKEtWOyYMk05bjjq/nOFR+Uz0fmytyC0ckl0YCNIq7 xSnMPpC+3QXwJVzi+oWIF2v0ztlU7UTt9XKDw/UAFKiqHxKh4LYv5JsCvnJg/5+F0ilbBw7ofix l7ym8ZwWU4gNb/RLr5P9FutnblHkx0/EnQowNpXZYuY466fMQqOMpYXUfXMSZaBEiDDNEBI92ZI ATlglIaRYzcsYJ++OS6diPMAZKVlhvV5+ycmIlSHPbDcbw6DSe5rtSqI4QsJBggVLVyNIy9vVyo p3PlC+H7vuDtIS3Hmbest3aSM8PX0E1iSB6DWQVZczPG4jJ X-Received: by 2002:a05:6402:4005:b0:66a:3390:30d0 with SMTP id 4fb4d7f45d1cf-66b28e74b5cmr2839259a12.27.1774635068629; Fri, 27 Mar 2026 11:11:08 -0700 (PDT) Received: from ddolgov-thinkpadt14sgen1.rmtde.csb (dslb-084-056-106-044.084.056.pools.vodafone-ip.de. [84.56.106.44]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-66ad541489esm2807490a12.0.2026.03.27.11.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2026 11:11:06 -0700 (PDT) Date: Fri, 27 Mar 2026 19:11:03 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Lukas Fittl Cc: Masahiko Sawada , PostgreSQL Hackers , Paul A Jungwirth , Khoa Nguyen Subject: Re: pg_buffercache: Add per-relation summary stats Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thanks for the patch, I like the idea. > On Sat, Feb 28, 2026 at 03:58:34PM -0800, Lukas Fittl wrote: > > This can be used in monitoring scripts to know which relations are > kept in shared buffers, to understand performance issues better that > occur due to relations getting evicted from the cache. In our own > monitoring tool (pganalyze) we've offered a functionality like this > based on the existing pg_buffercache() function for a bit over a year > now [0], and people have found this very valuable - but it doesn't > work for larger database servers. I see how relation footprint on the buffer cache can be useful, e.g. how many buffers per relation are used as well as how many of them are dirty. But how one can benefit from number of pinned buffers and average usage count per relation, is there a clear understanding of what to do about those numbers? > The pg_buffercache_summary() function returns a > single row summarizing the state of all shared buffers. > The pg_buffercache_relations() function returns > a set of rows summarizing the state of all shared buffers, aggregated by > relation and fork number. Maybe it was already asked before, but given those two functions (pg_buffercache_summary and pg_buffercache_relations) seems to have a very similar goal and the summary is just happening in different ways, is there a way to somehow unify them and have one function instead of two separate? It could be a unified function implementation and still two different interfaces to call, or even a single pg_buffercache_summary with an argument, specifying how to summarize. Also, would it be useful to have a numa-aware counterpart for the per-relation summary? Something like: this relation has so and so many buffers, and 50% of them are located on the node 1, while the other 50% on the node 2.