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 1wAaWS-0006xt-1E for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 21:33:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAaWQ-002Jkn-27 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 21:33:15 +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.96) (envelope-from ) id 1wAaWQ-002Jkf-1D for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 21:33:15 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAaWP-000000004Q9-1TrL for pgsql-hackers@postgresql.org; Wed, 08 Apr 2026 21:33:15 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-b9c04152730so26046166b.0 for ; Wed, 08 Apr 2026 14:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775683992; cv=none; d=google.com; s=arc-20240605; b=dbFY7I6n7g5SmMYvek4EmAQzOknxpZBXzIrqYxuRz8/ARad9djpnpAAdJRBcaO8Qs4 /w1dwyU4Ujp9T9RGGsI/etlGAsn2Y6fg/7OBKM3qzfS8fLwxOKU0RJUamUBCClCw+Kit 2SMnNwfMk3Qrly53gUSUXVD+lFC15a/F9FNA7HxHWhmImvv9ML/nM8P4yJ9VJbPH2Wli hHjaAFlhN1J0O9qwzlXNa0J1xowi2F/aBV05V59kEgKfrfTLsk+xjdkTXJwb9Hm/oEoq KUTS3PeMS9ELudjKoAojjeptl0aHluXvrJ6XT/lwx1G5BklK0i0zhS1ouIM4meuyO6ki lo4g== 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=IP6u1aLc0vnkKlT4Yw31EEaSE7CHyyW4zxiRPcG/GQI=; fh=DAg96v35GvUZpTigGCWSD82WS+hO55rg4y7m6N00FIs=; b=G5pwjxHSB0nMghEleE+PIxzLM5F+H1quErlcxL7cTRsZ19HaUkUSYhibbdUjvS+GTp AZt8LxyFw3rPv7beVeQ+WUHszIs7y31bStR1vj1Tse+3+/G+nLBtxIodh1S4HMQ3X2mp JnWJUOWcU0ZQIlFYHcFj62V39pyCQ34xPehemhQClgufY46Atkzt85UG1BWkRPPsvugZ p4w7s2Su49YJEFyLMnEoFJRVMMKCpqonxJNS6CUNZIvjOjgMX0SIo9GY7+Pwn8M6tXLg FUL0oaUcSmOP5O1C5Kavan5uHV6BbNfcH/uzfYebNQOd3PvxMtGlRT8SG4O3oyLHn8dC 3v5Q==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775683992; x=1776288792; darn=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=IP6u1aLc0vnkKlT4Yw31EEaSE7CHyyW4zxiRPcG/GQI=; b=FBo3Q6PyccPN4MN4kqhqy5OeGFgF+b6JjeuQO7WhbfzhfrycqtmJhbJGX5FhBXcUCl jZ6xKLoAdic9SPp5MRfyqgZojNATw4xCddf+Nml54GBOcsCwkeeIL1/SeGw9m14CdRZc 4+l4Y5cExwoSezBhveid6QKhRGusNzsQIzgPyZbE4dNCK08AtWA7Fw2jJb+KJrzfJ44U OSysXpuh1LNnP4L+45v233qvl7+XT8gp38YUR27hnuAe3YPu+JvzZQtHwpLQEVGf99fF pzhkN74ONV3lrGtwvn9PCPGW4MDcuqf19MrEKyPtLisPyQr6AsKFGnUFdc8GunBSGJzN 3XUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775683992; x=1776288792; 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=IP6u1aLc0vnkKlT4Yw31EEaSE7CHyyW4zxiRPcG/GQI=; b=SEk/WFsZgEDmaMqZkMQt3K1hxzPXubrF9dTBM2IJUXj/n7vMj/5HXTs6oraayd/MiC RoTT9nOJ9/W7nIy6heczUnhHJIsjnIPoO8o4rKONbDrzRgDbNR8peHKc+p3I0aQFE6wk 84hOMwDGA+3IKKv9g23FKWlnCUdaqt/tBpb+r34VBjQrXzbpM3SHFCJhK1JXadlOd/zx CfS2gLiKu3rjXKZDzNYWzBY6oK49iHyISgbOvx4f9+HrKSJmtyCwpL9g2kf321mKl0sr xcVGNv8Y2y68wFTLlzN7xH/3liHDlM0wPchCftU6tlneM84gy500Zd1yEx71hQUS+PkZ hnkQ== X-Forwarded-Encrypted: i=1; AJvYcCUch3rRkiX31hnP0eYC6x00QiEswGRgSEy1LwjhnK5em39vdxiiAVlbv1j+olUNV0cXuNePLFcedvfuH2Oy@postgresql.org X-Gm-Message-State: AOJu0YxydYq1vb57S3a9ktkLa+O8jWgdPxLntx3uH3IMfKqi4aKHqpjy CTn9ZaQ2mTBdtxJqEFocqkJuv8r3eqKARsZXzMgJMR8vKFNk1leR2dI4WfsqPUvkeU8OsDrWGH3 DXzS8ua1Ebb4rW+/fTF1eN55174VH50U= X-Gm-Gg: AeBDievPc7QAKlwy2O66LSbehIkNq3yPrICnLMxoIijxR+7VeMH4884uDYnn+JsNdxB 9ZQbyZPf6XYCLd89zpL4Qc1bIPI7imlzgE4cqYybkCpJTl63XU/zHpKte+Ek5MbIEWp0/vCmh7i x2jBtE1YobKOrUnXN4fRYgpvYikPijVQVWyD0L5TT2Rbekq95XSjCK8PQW1+i1+O4zf+vllCIMu 8jbsH5bBjGCB32P88LJn0eaUciDRO7MFNHC9EII7/EkGZFUD4xLxU1H6MzvfGPi+7VIthCCNxXh rj7qWw== X-Received: by 2002:a17:907:d87:b0:b9c:a063:ae2f with SMTP id a640c23a62f3a-b9ca063b282mr915164966b.41.1775683991842; Wed, 08 Apr 2026 14:33:11 -0700 (PDT) MIME-Version: 1.0 References: <5684f479-858e-4c5d-b8f5-bcf05de1f909@gmail.com> <3077290.1775668665@sss.pgh.pa.us> <3097984.1775674400@sss.pgh.pa.us> <3101163.1775676098@sss.pgh.pa.us> In-Reply-To: From: Sami Imseih Date: Wed, 8 Apr 2026 16:33:00 -0500 X-Gm-Features: AQROBzC9T6ATRabcY0GJ32D7CrS9oJSkQUW7EnhzjgsgPsRJPHXHK-WMvrQnTD0 Message-ID: Subject: Re: Add pg_stat_autovacuum_priority To: Nathan Bossart Cc: Andres Freund , Tom Lane , Alexander Lakhin , Bharath Rupireddy , Robert Treat , satyanarlapuram@gmail.com, pgsql-hackers , tndrwang@gmail.com Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Wed, Apr 08, 2026 at 04:40:03PM -0400, Andres Freund wrote: > > Note that the whole cached state does automatically get reset at the end of > > the transaction (AtEOXact_PgStat()->pgstat_clear_snapshot()), just like it did > > before the shmem stats stuff. > > I see a lot of memory used for the pgStatEntryRefHash table, too (e.g., ~16 > MB for 100K tables). What's interesting is that I cannot reproduce similar > usage with views like pg_stat_all_tables. If memory was not a concern, I > think the "bool *may_free" idea would be fine. Instead of may_free, which is invasive, what about pgstat_fetch_entry_nocache which can be called by 2 new APIs pgstat_fetch_stat_tabentry_nocache() and pgstat_fetch_stat_tabentry_nocache_ext(). This way a caller that uses these will be required to pfree? This will allow us to also avoid the GUC override as well in autovacuum.c. -- Sami