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 1vzsDI-001OsM-0R for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2026 08:13:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vzsDF-002BLJ-0D for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2026 08:13:09 +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 ) id 1vzsDE-002BLB-2K for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2026 08:13:09 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vzsDD-00000001Q68-1wfN for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2026 08:13:08 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-79868cde1eeso136736387b3.2 for ; Tue, 10 Mar 2026 01:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773130387; cv=none; d=google.com; s=arc-20240605; b=jKndF2mzlUpsl1XsexzOSEXzvBeyc87ZDMc1Mo6CYNAXkj2rpVs2uUX216wc3phyxk 95RUpOn408s8/doas2I80WF52tab6R8T5bom+UK1Vj+68Gw2DhVVx394riq/NYO9vKbP 4cDI9VO9EaA+FdecRiZISN84ZgrZQpboo58IrinQ2DHy64z5cgnI3cEufZaNP+upCDTN cRgLg0IOhGeDoxdUPN2eNhapv56e9zfpXsn4cdHVQbrjd6AZGRe5NuwBZizZIwsqm9Zk NFx0widBVo60hWPSXJIXCgJx+8cM2wv/WCWVncA+thWd++YgDvgvaKH46I8wdkJlXpJZ 12Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=3Wf2iLo1RGVR3IXKbPfCZtpdHDerSOTHSMNwa4ZzlSw=; fh=KNbHZHkP1tt5t8UvibSexJtEF5PUbw0pfTUvfDM7Gw8=; b=P010gu3biCk3BAGs6Q3SXTDS5NXZzcPPdrgQMpoX29vcdF2qoE0nLgAeiyuR+cXpWh xaLw1zUdhawQddE3TEHSE6VJWJkt28Wtd/HYiCH97+38BlUjuz73afw82KBgOqwUaDx+ OpIuL7YlXQaOz+/x1/LFK/9a9i6Ly4QPy2JX16UPdUcoagYeL68NpOoV5Z0jj4ZNhCuL gO6ntbjuWt6bOBSDgnp0s4w2dfcHZLAW5yL9ykM6KX5BrIpmfYzqYkQLQnJpyNSrwocX fLiKYD5ynCrvYYjNwL5mczQQA6p5sr9cb/theY+qsY0lPD3G68cdZXuP4d+Hnio3scFk hm0g==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=percona.com; s=google; t=1773130387; x=1773735187; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3Wf2iLo1RGVR3IXKbPfCZtpdHDerSOTHSMNwa4ZzlSw=; b=cSIqvaZtwFcbO2N0VDQQreE+sfvblZTnhc48O9wD+fQkZHdknOFSFlsFm9zJtxsWsi Ex1crmwWEcnVzhURXmiTz4j8klJparaM1oWa9nuG+qlyCB82hj+EpiR4Etehw2EWdcb4 muvMkfxTgwjjyS/nxtGmykoeGB/UVDYKdvXBA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773130387; x=1773735187; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3Wf2iLo1RGVR3IXKbPfCZtpdHDerSOTHSMNwa4ZzlSw=; b=grx/cCqDt4V4FlxW0xB5OUazcmuiJb9IOW6Be0LD2BJay4Tm05ryUedDDUJKlMcSft ioX9GgLv73/p5kzZna0KKI3HVTxQd96pG8wB+3YDPzd6/IPhYjbo6Tk69sE82se78DAj IfqLNZFawOgXoSSCzjaANb1nPA1VRT94Hg7T34WUk2+j+h12jPKmavxQIAfEPZLPgqwt 9MNAbNi0q2w4zN1k3NOABIQlGmMzZkP3AuntkvLsL+DiGIE8zPSZJsq0cW5LFN1+Pznd ELq8lXyZVj66JuncIgZjIOR1ZwlPSzLvCA7JiejTcmwzLH2pTYQG/YjgF8Hrko5TVyd3 pWAQ== X-Gm-Message-State: AOJu0YzaB+qsW4i0E50MZcxEIbpe9rF8Bv3Q9SGmCMrDwlkg2woChxww 56KeEnYML0zJk6WTwBGZ9/+ktEo7n4zHFD5i7b5MPQ6sEIlDUPDfDp73AdjVmLpuGjSfIXqmZIj mah0MThl+u8sxYeDNkGmeWsCnwxzQWuWWoJtPbCIa0IwwTEi6HildyZz/7L5WAWz68sUgwLK/xY QvtSonEZ0UkzFNMeiKP0ZK8qG2AjI9UIYUAgvZFIhR44hqjJt20/1IWcj6akf0PwEtcnODX5Vm0 8RFQBGJzW2Bge28FHXbja6VLvbjc2NP/jKQ7u8xpd2c734KTOW4POj0nEd3+nIHcb0= X-Gm-Gg: ATEYQzwViD85IUytKOm3QD50Pa5DG5b/f6iicnRzGvEHfXS7cut0drmxq0RbNdrEr8q TDHAxE9CiXiEM2Qy4DMuq/uot8eN5yXjDeehrw+tMl/TcA1i78P0kLg6HT8tcxrkAlbcKAQFQQ/ N6ox8+OxbHfdxpwWzosC1RaSKpooRN0sNwG/jjHtmStWgez69zTqYLb3Gobgc/UTS64nHx94vbD Rq7PzPAaUZ0xvWie7PHeuN8gGTdj9hXsslJyJ1jRKYv1K9I+9sy5DEJ2UZ1EbQUJs+jsYu3oAoH VRYgfL0xQocJYk8TAh4PQAVXg0rXnyRIHeJVoISbQq5BvshNjaZtmpmOQzFzltmK1yHH X-Received: by 2002:a05:690c:6b12:b0:798:6619:f1d4 with SMTP id 00721157ae682-798dd679f0bmr133343307b3.6.1773130386586; Tue, 10 Mar 2026 01:13:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zsolt Parragi Date: Tue, 10 Mar 2026 08:12:56 +0000 X-Gm-Features: AaiRm53NHWyb4J81QmgpW2qwf-JQ5_e8-w85x3v7uxsGQMrLJvO1tr28v8ga3SM Message-ID: Subject: Re: Stack-based tracking of per-node WAL/buffer usage To: Lukas Fittl Cc: PostgreSQL Hackers , Andres Freund , Peter Smith Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: percona,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > ResourceOwnerForgetInstrumentation directly follows the call to > ExecFinalizeNodeInstrumentation in standard_ExecutorFinish, so I'm not > sure which error case you're thinking of? There are a few pallocs between them, so OOM is possible, even if unlikely. I mainly mentioned this because even if unlikely it can happen in theory, and the fix seems simple to me. > I don't think that's a permanent leak, since it would be in the memory > context of the caller, i.e. the per-query memory context Yes, it's definitely not permanent, but could be bad with many tuples. > and so > doing the ResOwner dance for each tuple is probably not ideal. These approaches are interesting, but also add complexity, so I'm unsure which is better for this, the pfree calls add one line and solve the main issue with the current code. > Basically it should be this instead, I think, > so we correctly call the table AM's table_index_fetch_tuple again if > call_again gets set: Right, this code will be better. > I don't know if the extra allocations > really matter, but I can see your point. Yeah, probably doesn't matter that much, but the code also wasn't that nice in that form. I didn't try to actually modify it, but by just looking at it the grouped option seemed cleaner to me, and the output should also be self-explanatory and logical to users.