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 1t7tNE-000wbY-CJ for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 09:27:47 +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 1t7tNB-004oJZ-MZ for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 09:27:46 +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 1t7tNB-004oJR-D5 for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2024 09:27:46 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t7tN8-0006jE-3n for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2024 09:27:45 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so34178555e9.1 for ; Mon, 04 Nov 2024 01:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730712462; x=1731317262; 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=qt101Txmx2rBzLlTIVL22wOopCHy3f3Orz6L4F5upZM=; b=a67YHqrlpBVwdBYQhqozUGzcfbWIFkBDHogH7o66kQQKJTarXX99jBdDtaU8ndCSVj kDvtEjhW4jkpDSAZUBbBXFziIx4buCkRegZ4TAsvhGSvOqXmaLuX0NnR5ebmULNSKRpF 4uLufofKaaHO3yKlVEf3gKtPn7C8MCSMEXaIn9T5ZLY4G4Xwl8+4lzHHmVgbRgVCqoe1 zvoXIMl1SnD/Rs5/n6CeG9XAa611B0+KZf/wJYQ8zULZGWpkXtcMCw6cexeVn/QDh3yK Tve28Sx8lzwvkVq4tq/X5/uzg8kr9PyO0o4473LbET+F0rMjzFi4Y2ogs7AJItgJ2ZpV 73HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730712462; x=1731317262; 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=qt101Txmx2rBzLlTIVL22wOopCHy3f3Orz6L4F5upZM=; b=YbuB0fP/wqejuKEPO5LxuhDyfRBzkM2aJMKKjOEfFddHPIla0nsNUQD6d2T3E2cqkO v4R+xTs6EUP3yLvi176jVx7iFFc1kx9gSJ8TpDOd6JbWffnIaAXIVXzWEBG5XG7Qco0o b1BehwdKuAJvbskqZZOrB4WJ1KOXS7M9OeA3m+zhumax+yHtZn6a9Dn+66Z3XaukFy8T WUFWCS+9QDAfGApn1xcg01ReS3yW2Ab0mIaKHL6FQXrwPcSXQ22ArXjzNyMVY1QQuoGV C47LcnZZ4ICIQaZl6VSJr41oi6qPHq/OaqMbc+Jivv9Yitm9r9v8uuGKbHTlgMo0G3SK F4Fg== X-Gm-Message-State: AOJu0Yzuw4oPWZPdWVX4mIr/QZ8M+mXnOTqMt3cfkIdcSLNIMIwBdao0 /kQ7vL9NxOi+pSYo+fOVWIJfiyE6V/Ws1BWdwnpfBiEMRS43vSfmDxkBiQ== X-Google-Smtp-Source: AGHT+IFmX6ML9DG9UbJAdSI1qhWXq07kduSmcUfJggYOEwLwEjuglmiRG6tZzcGOf5ry1+7aNAQIjg== X-Received: by 2002:a05:600c:3d8a:b0:431:57e5:b251 with SMTP id 5b1f17b1804b1-4328327e6d2mr85755945e9.28.1730712460562; Mon, 04 Nov 2024 01:27:40 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4327d685315sm148926725e9.31.2024.11.04.01.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 01:27:40 -0800 (PST) Date: Mon, 4 Nov 2024 09:27:38 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: 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 Tue, Sep 10, 2024 at 05:30:32AM +0000, Bertrand Drouvot wrote: > Hi, > > On Thu, Sep 05, 2024 at 04:48:36AM +0000, Bertrand Drouvot wrote: > > Please find attached a mandatory rebase. > > > > In passing, checking if based on the previous discussion (and given that we > > don't have the relation OID when writing buffers out) you see another approach > > that the one this patch is implementing? > > Attached v5, mandatory rebase due to recent changes in the stats area. Attached v6, mandatory rebase due to b14e9ce7d5. Note that 0001 is the same as the one proposed in [0] and needs to be applied here to make the stats machinery working as expected with the relfile added in the stats hash key (though it deserves its own dedicated thread as explained in [0]). Don't look at 0001 and 0002 as I think we need more design discussion. === Sum up the feedback received up-thread I re-read this thread and it appears that there is 3 main remarks: R1: Andres did propose to add stuff like "n_dead_tup" (see [1]), to provide even more benefits. R2: Robert mentioned ([2]) that we need to decide between "sometimes I don't know the relation OID so I want to use the relfilenumber instead, without changing the user experience" and "some of these stats actually properly pertain to the relfilenode rather than the relation so I want to associate them with the right object and that will affect how the user sees things". R3: Michael had concerns about adding a new field (the relfile) in the hash key, see [3]. === My thoughts: While my initial idea was that the relfilenode stats would deal only with I/O activities it also looks like that it would be benficial to add sutff like "n_dead_tup". Then I think we should go with the "sometimes I don't know the relation OID so I want to use the relfilenumber instead, without changing the user experience" way. Regarding the concern about adding a new field in the hash key, I think we can't avoid that as we don't have the relation OID when writing buffers out. === Moving forward I would go for trying to store everything that is "relation" related into the relfilenode stats (that will then include n_dead_tup among other things) and try to hide the distinction between relfilenode stats and relation stats from the user. Thoughts of moving forward that way? [0]: https://www.postgresql.org/message-id/Zyb7RW1y9dVfO0UH%40ip-10-97-1-34.eu-west-3.compute.internal [1]: https://www.postgresql.org/message-id/20240607033806.6gwgolihss72cj6r%40awork3.anarazel.de [2]: https://www.postgresql.org/message-id/CA%2BTgmoZtwT6h%3DnyuQ1J9GNSrRyhf0fv7Ai6FzO%3DbH0C9Bf6tew%40mail.gmail.com [3]: https://www.postgresql.org/message-id/Zo9j69GhexDpeV4k%40paquier.xyz Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com