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.98.2) (envelope-from ) id 1x8qz5-00000001YIa-3iZA for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Sep 2026 03:15:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x8qz4-0000000D4yo-2qKd for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Sep 2026 03:15:54 +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.98.2) (envelope-from ) id 1x8qz4-0000000D4yf-1cKr for pgsql-hackers@lists.postgresql.org; Tue, 22 Sep 2026 03:15:54 +0000 Received: from mail-wm2-x11.google.com ([2a00:1450:4864:31::11]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x8qz1-00000000bEQ-3L7R for pgsql-hackers@lists.postgresql.org; Tue, 22 Sep 2026 03:15:53 +0000 Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-49d1fb0cf5eso25551605e9.3 for ; Mon, 21 Sep 2026 20:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790046951; x=1790651751; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=C2kbE6TPeh8yYc9YHCF52I4IeF3X44+nZfHZFTqDSxs=; b=m/7BcTpp7sGPWHWddTzDp47LkuuOKwjGNdX7iTQb+Y+R3QNZl2K99yYOQc3M8fztOr e2iQTtz50YlQZwRP19wsIHXBi7z+y5v/avRHh0FKPniPp69XDfuEvy9CKd3KLncw/uXn 8Qn/0k8Des/NAzEMTYbs3rpEYc8nZuoEHLq0S1R4zbAWf9pEormHGgkFkvHSyXDGR8Uq byEpdc2cZvWUXfVbYojd0WpbuT99iewHqlGJT1b2K6os6j1oGsgSNRnBWxcsikZX63W8 r+XzZ8hVuCZ0k6/vzmeN4cPggZhZbOAjNFojckMtKy3UUIgigGOuCHj/x5JmajHUrat7 SQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790046951; x=1790651751; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=C2kbE6TPeh8yYc9YHCF52I4IeF3X44+nZfHZFTqDSxs=; b=TTWasu0PJMDBxEbE0W/jG+Mt12lH6WTL8tv3MzP8YVAD6+nTCDz6RvQZgYnfPxueKW K0KbmpyGgjd9jribvm2lUJ21YMmSO6Im5LPJ2j9uXUsj/+RxMf6P37z7usMrZfkQoSmT qgBqqmm6Gc2PZr8UA5wku3yYcONlZKjs28z1JUwahd3TIzzoZ353Bd/K6+sYLSZbR9xM UivBk2WJHFO6rAsHlwjNSbjI5dG1uOfNfyojIGUv1GehVP+42AN71kpZy2yEPszGaH+f jGD3UL4pAwDtGyrFXgl/KVZWhfZPCpPDbjCOQVk2wdj3mDr6wJEQVBevMYzaqJT1l0va QXwA== X-Forwarded-Encrypted: i=1; AKwUvByW3FvVC6Df7sLU2/wL3PVhzfx7J4lkOs90+vVzaq3mzHX+v1FH2GT5OiRGy9gPogPL8nQDKqLv+AmB5bmS@lists.postgresql.org X-Gm-Message-State: AFuF++ngB57rP1mQqLL6utK29EqtGl95vBZ9g+4nKotTNXzWeCbq+OuJ ELBmFR2+SHwHRPxfnPxq7sw5Oitkgh/UkNFNGDOA4j9YRDjs9y4LER1t X-Gm-Gg: AYBFou3UzV7aeL5wu6O0gkop4sD4fJiPqoTqxQHoo/S83CDEtFnDp3/Mk3IB+QHwGhH vUAoFq1vaDtyqKkxUx6HLHwsuPWncogAkoPAj7sRlfAlVPo+NdY6igdqNpJ0DKtjkKVdrpdUBic 5XWosklh4M61GcNo0xOBE9//eBAqFRo3Opj0+nnk6mu5rOM+KpKm5v383pydDP8/KvU7oRRjtNb D9SrYXIfIWSqXQgz5PYbT7nb74QlRKMcUuX6dvld3b2SsYfT9F+5yhipSYhsgPv5ojhXdIKYJ/O f5SQUB+dy3FZPTNn1dfrevj06+BBEbbeXT5NjgVN5etOIVB1710VZNPD26i1dytlYclY9ZQdRGO mABxvpseaicneVsiCUoENXdXF5Vs8N49KGntOJnUj2T+D8cTHB9l2OaKJkYoKUfeAt7WktC/KGA DmiRQKHbfUNDmia7sNvHCCbRMjXcJmExYzSf3Gj1ASwy6FPAl6BBWVi6m7IKKQlloBE2tHK5xjz ZuAZ8UNHSL8EJaq+Jhm/a6HY5EI44gtmFp0j0i6b0TMZRqmb7/yGB2meg== X-Received: by 2002:a05:600c:474c:b0:49c:f512:2361 with SMTP id 5b1f17b1804b1-49fc569587bmr188092155e9.14.1790046950652; Mon, 21 Sep 2026 20:15:50 -0700 (PDT) Received: from bdtpg (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fdad40b4dsm14014505e9.10.2026.09.21.20.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 20:15:50 -0700 (PDT) Date: Tue, 22 Sep 2026 03:15:49 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Andres Freund , pgsql-hackers@lists.postgresql.org, Sami Imseih Subject: Re: Redesign per-backend 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 22, 2026 at 09:16:30AM +0900, Michael Paquier wrote: > On Mon, Sep 21, 2026 at 05:17:04AM -0400, Andres Freund wrote: > > On 2026-09-21 07:15:44 +0000, Bertrand Drouvot wrote: > >> +/* ------------------------------------------------------------------------- > >> + * > >> + * pgstat_per_backend.c > >> + * Generic infrastructure for per-backend statistics. > >> + * > >> + * This file manages the dedicated per-kind dshashes used for per-backend > >> + * statistics, including entry creation, fetching, snapshots, transfer to > >> + * global statistics, and removal. > > > > It's not entirely obvious to me that a hash table is needed here. If I > > understand correctly, this just going to be used for per-backend versions of > > fixed stats. Which means we could just as well allocate all the memory in > > statically allocated shared memory at server start and have the per-backend > > stats be accessible by nothing more than an array access? > > Yeah. Array access based on an procnum index is still feeling like > the natural thing to do here (I think I've mentioned that upthread?). Yeah you did mention it. I took your reply in [1] as agreeing with the concern about reserving memory for mostly unused slots, though not necessarily with using a dshash. Is your preference still for the array despite that memory cost? [1]: https://postgr.es/m/anlVx_TD_Q8He5uf%40paquier.xyz Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com