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 1tIQBi-00EE9h-V0 for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Dec 2024 10:31:26 +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 1tIQBg-0093f0-9h for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Dec 2024 10:31:25 +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 1tIQBf-0093eK-W2 for pgsql-hackers@lists.postgresql.org; Tue, 03 Dec 2024 10:31:25 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tIQBa-000oEi-Gf for pgsql-hackers@lists.postgresql.org; Tue, 03 Dec 2024 10:31:23 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-385e2880606so3403744f8f.3 for ; Tue, 03 Dec 2024 02:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733221877; x=1733826677; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=sM4kyl0eDp11B1hrGwJYvvAqFSG01PwM3sEb9KqwmEI=; b=EwAPQSmISRw0N8c1yA37dno7gtkq1fBFJp7SI2eFiy6zjvJmEzZAmbm9GLlpK6IreK ZYCcyewEyMZ3cIYxWv7ybXgkeTNUTZjP1DRu5owetMhSA9zYLOJ+LDPYV//i5iQvLxeK iS7r6zVOmFDzLRTwdBOHJ3aq807bWXXpN5MEWd5OHwui15JfojktqT845jGSkz7Rbx7F MpmbnXKpVZmn0U+XpFlXQNDqrZnb/mNs6X5GLBQQ2sDdVfpd1CObRU1LshCGhNMV92Dm WtvJXeeWkXs3WVHb5RW4L39dOxBgq8u8/31izRHq2+1xqL9K2RGSh8zvUfZ1pdhIRZv5 5YHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733221877; x=1733826677; h=in-reply-to:content-transfer-encoding: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=sM4kyl0eDp11B1hrGwJYvvAqFSG01PwM3sEb9KqwmEI=; b=XuRL2H6SftfwnQwIDmtoDB4I768S6hBp/KePXcCe2kdicPDe3trDUmJJNfqB+kyoY4 z6TVo2DTftSMQQamTgzCDDavtoiffs8l1sz3Ae3RWMacXZQbHbLkklIHguLWmdRwPen5 ePos7pH2JB2NQjJXlnPyDkkEfQCHWacMvOmKMWfTRUVWtJ5k++jYx9Q1nzDgFASdL6go VVCkP4umWcghvSoXlySDZ3tQMR1Ai3h5wsCAMVrCNcI0odc6bYDd0EalX7S4/94dhxVC 2lah0vAJrdRwQ/FdeLt3OSHxgMUTzD5+Q/3yP/azfvq63uRtw2mHMuHSaCENnwMtfsCk wDGw== X-Forwarded-Encrypted: i=1; AJvYcCVJZqFestQyPJ17N4edLG3vUCNHyKtK6wIU9+TrYtF436IAS1p+yONbivWZ4HroSE/3bqSspKAsVyB906do@lists.postgresql.org X-Gm-Message-State: AOJu0Ywv3iGI9RsvYhc6cYv+rYk4JCfQ8g+N8SOoXS+KgPBPu0uP0PRV 76R6mET3o1z7n54ObV95wA5Yua94Nqbd8gGv0oIpiQdBT4YIrj9L X-Gm-Gg: ASbGnctHn5t1bE+qmR80iPFt2xnyXnHfksHYtotseoJ7qmX12F9jHk2S/BZ2Yg0JglG JnRY7ysmc3L3t67v8Oj/BuuMFAEvKy0WHGRPtK0zQ+T6umv39CooFYs9luU1thdyXg9NWwycC/p 7b5PkFz+Cdt52GDrWtHlUR1a1zkzqGDqqDRlik6R/OxrT54zsnFNUsJS1dYbPFak67wpYAEbHWV Xm8jDVilJEmnMgIpgXStkDxqKxV840x5kZeFej95Pq+V0Nj03xN2tTzIGqEsVFf0LrI1RF8I33x SaORds9ZPOgiYSjlUTc34MojPlljmxXuyx5Lmu8jpWlE4pL4+T2bJfOR3zjoDRT0qO3pZk2QMRm j X-Google-Smtp-Source: AGHT+IHyFIyroNtnkLRhYULBdFkC+WZJwtsLlkEKgLsnygDFXCwpqlbmze/HjDtCo9NDpOnUzAea3Q== X-Received: by 2002:a05:6000:210b:b0:385:f560:7916 with SMTP id ffacd0b85a97d-385fd3f8de5mr1706330f8f.35.1733221876846; Tue, 03 Dec 2024 02:31:16 -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 ffacd0b85a97d-385eb10bf7esm7792550f8f.14.2024.12.03.02.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 02:31:16 -0800 (PST) Date: Tue, 3 Dec 2024 10:31:15 +0000 From: Bertrand Drouvot To: Kirill Reshke Cc: Robert Haas , Michael Paquier , pgsql-hackers@lists.postgresql.org Subject: Re: relfilenode statistics Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Fri, Nov 29, 2024 at 08:52:13PM +0500, Kirill Reshke wrote: > On Fri, 29 Nov 2024 at 20:20, Bertrand Drouvot > wrote: > > On Fri, Nov 29, 2024 at 11:23:12AM +0500, Kirill Reshke wrote: > > > If we don’t have the relation OID when writing buffers out, can we > > > just store oid to buffertag mapping somewhere and use it? > > > > Do you mean add the relation OID into the BufferTag? While that could probably > > be done from a technical point of view (with probably non negligible amount > > of refactoring), I can see those cons: > > Not exactly, what i had in mind was a separate hashmap into shared > memory, mapping buffertag<>oid. I see. > > 2. Probably lot of refactoring > > 3. This new member would be there "only" for stats and reporting purpose as > > it is not needed at all for buffer related operations > > To this design, your points 2&3 apply. That said, it might also help for DropRelationBuffers() where we need to scan the entire buffer pool (there is an optimization in place though). We could imagine buffertag as key and the value could be the relation OID and each entry would have next/prev pointers linking to other BufferTags with same OID. That's probably much more refactoring (and more invasive) that the initial idea in this thread but could lead to multiple pros though. I'm not very familar with the "buffer" area of the code and would also need to study the performance impact to maintain this new hash map. Do you and/or others have any thoughts/ideas about it? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com