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 1t5V5D-006WFJ-MM for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 19:07:19 +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 1t5V5B-009Dcu-VA for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 19:07:18 +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 1t5V5B-009Dcg-L9 for pgsql-hackers@lists.postgresql.org; Mon, 28 Oct 2024 19:07:18 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t5V59-003JfT-9f for pgsql-hackers@postgresql.org; Mon, 28 Oct 2024 19:07:16 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2fb4fa17044so46738201fa.3 for ; Mon, 28 Oct 2024 12:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730142434; x=1730747234; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=w1BL7rqYU5Cj8QcHUfHfn4IPC4FR5l39RexIZVp/8rU=; b=T7Qe5QDSaLB+ofYsMDXfQR9Yh3g13KIhLmSGNDRLxF1daIOnwMTrTRdib8dCSp5Mt4 XYif3AmyHBPZbN/BRonFCOILfmqJ/VQADu52+7ccj7RjJuPRsjf8lvuJH62xY3OoRMaN fzP5MAd+GsZjzNNf52/AqpWYkVr7Y6Cx9VQ6cxQE/tG3G6FoKPfIMRmq6XvtpX35JTq+ OTupYhGGVKcPTvBYhrn6/iW+JPcozBB0elQcBWXhwDkZwB/KGUyB4eywqzxt5jgecDbC KxL4m6n7GJq/Q4N6kvVtWv23MW1WKPJVApfnmFmxZ1PnA4AAYRM7zFrk8lFLGx8/M7Rf Yf1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730142434; x=1730747234; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w1BL7rqYU5Cj8QcHUfHfn4IPC4FR5l39RexIZVp/8rU=; b=lEjo3WCtxvzSzIX5AAL57sHr0Gc7a5ZPmsHQW+ppcgrVu6hnsGoAstQL29K70I9V7P JpQWXdYkVOBPDJ8VaRihqctRv8S0eo5T7lsf8pnHti5bvy5fCQkhxbOunHmPNPrGpIRz jHT1Nkn7Y6/b0ArEoJO3YDkXUJXgwGmtF9zi0na13+kOfVvqs92mXGd2kvPzsmd9RGqn zIfsI8ZpuGAStQW9snNY+gnsRjW/xLRrynFowUUC5FZeqlcp9wxM9RX7FD2Uht8TTpAL M14wD4vNb3Xh2ciO6qWBvm9LZHistLYkcfpIQetovk+yNnrkBmNPU3F9dYidpY/mIEHM rkDQ== X-Forwarded-Encrypted: i=1; AJvYcCWaOQjsZCIiTwHmg4RAetdLBzOYYySWrNM++sHm4Biyq0Uv/GyU+vQ33zxPWyBC/Os7bmG1z0XBz8CT+4g7@postgresql.org X-Gm-Message-State: AOJu0Yya9SUVGc1Fz+4nwMMXHb5ecuhJhdkehBz7WhTb0OcOhKlhN5ZV aOpJIhHUYi8vKdYcR2sTH4p3aKkAaIP4IH3a33r9Q6MCdmOj62xBsXPfRRPX+ntfVnTY9KFjCqJ 4zo0UHp0JcdXgii2NsAfrQtzSFb8= X-Google-Smtp-Source: AGHT+IF2kIp5hdgkLOPOvZWkXeEEnaAUBzQ0BoF6QBCwIs92hPb+7zLku6L/Jr4pur0ZmCVjrZgBMWEhY1po63UP2Eo= X-Received: by 2002:a05:651c:1548:b0:2fb:6110:c5cb with SMTP id 38308e7fff4ca-2fcbe08cf6amr35088441fa.34.1730142433262; Mon, 28 Oct 2024 12:07:13 -0700 (PDT) MIME-Version: 1.0 References: <53c47c2d-72a5-44f2-900c-9973b2af1808@tantorlabs.com> <4a902cea-54fb-41b5-b208-b84731a5f577@postgrespro.ru> <092adec6-4eae-4bd4-bd0d-473a9df1282b@tantorlabs.com> <3deae1bd-ad84-4459-a26e-04c9136b84e9@postgrespro.ru> <9b10c6d3-52c4-4eef-b67c-c33442667729@postgrespro.ru> <9485d892-fd04-4e3a-ac24-7dd767cb7333@postgrespro.ru> In-Reply-To: <9485d892-fd04-4e3a-ac24-7dd767cb7333@postgrespro.ru> From: Alexander Korotkov Date: Mon, 28 Oct 2024 21:07:02 +0200 Message-ID: Subject: Re: Vacuum statistics To: Alena Rybakina Cc: Masahiko Sawada , Melanie Plageman , Andrei Zubkov , jian he , Ilia Evdokimov , Alena Rybakina , pgsql-hackers , a.lepikhov@postgrespro.ru Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Sep 29, 2024 at 12:22=E2=80=AFAM Alena Rybakina wrote: > Hi! Thank you for your interesting for this patch! > > I took a very brief look at this and was wondering if it was worth > having a way to make the per-table vacuum statistics opt-in (like a > table storage parameter) in order to decrease the shared memory > footprint of storing the stats. > > I'm not sure how users can select tables that enable vacuum statistics > as I think they basically want to have statistics for all tables, but > I see your point. Since the size of PgStat_TableCounts approximately > tripled by this patch (112 bytes to 320 bytes), it might be worth > considering ways to reduce the number of entries or reducing the size > of vacuum statistics. > > The main purpose of these statistics is to see abnormal behavior of vacuu= m in relation to a table or the database as a whole. > > For example, there may be a situation where vacuum has started to run mor= e often and spends a lot of resources on processing a certain index, but th= e size of the index does not change significantly. Moreover, the table in w= hich this index is located can be much smaller in size. This may be because= the index is bloated and needs to be reindexed. > > This is exactly what vacuum statistics can show - we will see that compar= ed to other objects, vacuum processed more blocks and spent more time on th= is index. > > Perhaps the vacuum parameters for the index should be set more aggressive= ly to avoid this in the future. > > I suppose that if we turn off statistics collection for a certain object,= we can miss it. In addition, the user may not enable the parameter for the= object in time, because he will forget about it. I agree with this point. Additionally, in order to benefit from gatherting vacuum statistics only for some relations in terms of space, we need to handle variable-size stat entries. That would greatly increase the complexity. > As for the second option, now I cannot say which statistics can be remove= d, to be honest. So far, they all seem necessary. Yes, but as Masahiko-san pointed out, PgStat_TableCounts is almost tripled in space. That a huge change from having no statistics on vacuum to have it in much more detail than everything else we currently have. I think the feasible way might be to introduce some most demanded statistics first then see how it goes. ------ Regards, Alexander Korotkov Supabase