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 1v3xtR-006G1M-Ag for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Oct 2025 14:33:21 +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 1v3xtO-003OlC-7z for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Oct 2025 14:33:18 +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 1v3xtN-003Okw-Sx for pgsql-hackers@lists.postgresql.org; Wed, 01 Oct 2025 14:33:18 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3xtM-000t4a-04 for pgsql-hackers@lists.postgresql.org; Wed, 01 Oct 2025 14:33:17 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-4060b4b1200so6397993f8f.3 for ; Wed, 01 Oct 2025 07:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759329194; x=1759933994; 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=I9btWCUABrAl9NxJSP8vypDi8hLY2LrN8SzVPpqXlwQ=; b=m0cLJjlfuqqoixNsApUnL4QT2cL9/c2ntrsHtVi9EPIxwy+7DztHUZNXAng/L4G/DH W6scWNyxZBLClJUeh5mr05haHpbkZ3hOvRMfms8C0WQJAjiYIsAE7o7ptNOBvjIBCvtb hyMv0kwGN2PTKZ0ahcVKqcJGkFZdwq09X8hMFydSptAyFqQ1pWfcLAvxldomOG3cqGgU SbSYV+mMsEQeBijbWUDZRqI2K8JflZ6s3b71FsQsjQaB+QvlW4MOutra2r4MKFhz50zs xKYmKfY8vYiC2THSVJgskzLlt14DMcI6yWQlzfovIas68JIzuhlJBRfOJKGCT0/IRNf+ OW6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759329194; x=1759933994; 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=I9btWCUABrAl9NxJSP8vypDi8hLY2LrN8SzVPpqXlwQ=; b=TmDy1AWmg2yruD9IlfzhFB+RkLXVeOpDLgL/Tk9NuWBB5lEZL+sOWmXmh7MUKMU6dP FxmbYXPzF7Obh4oPb8EJmYo3+H62VovJsLaYVJvveYJ1e/JDpzQY2HYv+5LbavjVIiCO 4ve+Q6NARn3n6CtKMtIFjQjtjUd9abZKZ2tcwPGLgYItOtQuXjF91MH2geleXohp0I/Y ooObhgdUD43JG0fUZs5MhQE1xEqs64j+u7Cp/PXe6eXsdcYnjVZm3pUPgktjeC/QP/E9 9EJkN6131pNVvQ0YGXz+IBgXTpeJVSJ+axMR1SkXaTLphtEQ6mFBI9oq8NHlNWeiYhGk m5iw== X-Forwarded-Encrypted: i=1; AJvYcCXbS7vPnhQ+/b+w1cvvnTuB/W5xYWbVokD7u7di8c4hwMzl2LdcolF+Yf1T4KwlVf0eTztbmCJSG3eRj6iX@lists.postgresql.org X-Gm-Message-State: AOJu0Yw+GcV764MhNXCMIrKpuYA+zIGwVKHSquz7pULbJ04As/pz3XeM djkyDWzA8ZJBGqMmFioQNyhLIdlj9BP+Vo7O4yAihJhVIREH6yiGpVtq X-Gm-Gg: ASbGncv3gKEc6rtoXQmamo6sqBHKG3hJdEfYeJTwAES5lAWeQYk48jiSMbpQmEE3YWi 48R7IvGe+uz43TBXEldWZthlGCDJev0IwjnyQCPyUyIhU4RLQeGx1Dbl8IL48NqTb6ugS7fTeWc uukrRPDqhI1jK1TIIOGOYUQlCj1cnihFkQWIaHNgYY6KAQK7t4TCFw9MXuIqTr7/O8jOTq2lLNB EN3P0SSc2RsGynOUvR5aL5m/jtOYeQg/AIWEURVKXB7S0G0fmMb9PMRXG8DR3e6kpYQNmFABerD QmaavnaDoYIUJ03U/GJ5YPcipzP6or9kHGUKdqGHWtgCC794Dv3nY+4rZmmb8DVWtgpk92q14bt XWfHGUldpEihfoVBX0Yx+qblbh+XMKEG60UUY564btgC/KH+rzWIt5tF6Bl8AEaSkCw8H0PRyho R0i4KyDWApADUgjFRCRrkn52C+vtJv40mJAjW2r9sswrfl6GiYJKPQRqncNYiyU7aD+Wb4CIFFJ 8KCIPDz4twCzOQU X-Google-Smtp-Source: AGHT+IGGNv4BHH02BLxvBCxLf8WDfq41XcmvOnrIWAc6odcEUp6x9FqGPQNPvzmZiXCzACf6MMBaXQ== X-Received: by 2002:a05:6000:4387:b0:40f:5eb7:f234 with SMTP id ffacd0b85a97d-425577edd3bmr3272366f8f.5.1759329193678; Wed, 01 Oct 2025 07:33:13 -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-40fc749b8f9sm26901186f8f.50.2025.10.01.07.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Oct 2025 07:33:13 -0700 (PDT) Date: Wed, 1 Oct 2025 14:33:11 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Kirill Reshke , Robert Haas , pgsql-hackers@lists.postgresql.org Subject: Re: relfilenode statistics 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 Hi, On Wed, Oct 01, 2025 at 08:05:16AM +0900, Michael Paquier wrote: > On Tue, Sep 30, 2025 at 10:13:57AM +0000, Bertrand Drouvot wrote: > > As far Michael's concern about adding a new field in the hash key, as 8 bytes > > is allocated for the object ID, then we can go with: > > > > dboid (linked to RelFileLocator's dbOid) > > objoid (linked to RelFileLocator's spcOid and to the RelFileLocator's relNumber) > > > > and avoid adding a new field in the key. > > RelFileNumber is a 4-byte Oid, so this mapping should be able to work. Right. > Is there any reason why you would want an efficient filtering of the > contents of the shared hashtable based only on a relnumber or a > tablespace OID? Not that I can think of currently. > Perhaps yes, like when a relfilenode is dropped into > a bin for an efficient removal from the shared hashtable so as we > don't need to do a seqscan, I just don't remember all the details of > the patch and if it could act as a bottleneck in some scenarios. I think the first step is to replace (i.e get rid) PGSTAT_KIND_RELATION by a brand new PGSTAT_KIND_RELFILENODE and move all the existing stats that are currently under the PGSTAT_KIND_RELATION to this new PGSTAT_KIND_RELFILENODE. Let's do this by keeping the pg_stat_all_tables|indexes and pg_statio_all_tables|indexes on top of the PGSTAT_KIND_RELFILENODE and ensure that a relation rewrite keeps those stats. Once done, we could work from there to add new stats (add writes counters and ensure that some counters (n_dead_tup and friends) are replicated). Does that make sense to you? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com