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 1t5Pys-005xJM-BW for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 13:40: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 1t5Pyq-006rFY-F9 for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 13:40:24 +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.94.2) (envelope-from ) id 1t5Pyq-006rFQ-5Z for pgsql-hackers@lists.postgresql.org; Mon, 28 Oct 2024 13:40:24 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t5Pyk-003QBH-Kt for pgsql-hackers@postgresql.org; Mon, 28 Oct 2024 13:40:23 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5c937b5169cso6696333a12.1 for ; Mon, 28 Oct 2024 06:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730122817; x=1730727617; 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=AMg0Fhpw7pkX3TmR/S9139ip3WrMZPYLo745gK/1a4w=; b=WrAIdpL6iPW/XQzQIO9PgqG4v1JUszyryE9oVGYbOleJ7pudWh5pAyr3C4Y5uksH+f 8h3qN+ijeU2mVSkQo90XSqZprzlMATAwZm/DyFphiC97gGpF9xwCXV0RaRzBJDKGWES2 Zt9ecqabQVpZQgjQmc7TrKESLJflG+U9GfXoUthPmHowKs3k+DxXIOZ0cLIU+Ht+r9QY OkONliw1XOX4oQF6WYV/sUF2r7B6ab5el2z7KJDKIP9THFvYwV8hVFiiO5qxTc8GUkwZ ZXoVNyuvGlZon2QRm2OuFPPRJLAIKNPalQaZQf+8RfHcHZuoSHOFqqimKQl82CfEmVSH S5BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730122817; x=1730727617; 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=AMg0Fhpw7pkX3TmR/S9139ip3WrMZPYLo745gK/1a4w=; b=aG6gmLOcb4aZF9MR3n1VM6TBkbAiYWB9npoYEI8oKcMqBI9yPPXHjbwXrfUM3BCpTn rq1bLroVRuFeB0fJKofezOZuhUfKRHF8QerBOXxk0YRvoCZS68egLLP945hD3POaHkaR qcPc8NKJdytztfwT3ywcFZxxJLCPBrSb8bhVCfsaLWM99lkiVdcXHISJ0ESgGXWyOn8y fQ/vnFRqe66KJhfo5Lb73lA8G5BWZD8/uw2qN4b8D1PgVMQigp0j5OWC9ipnsK/Iy++U 5Og09yMrri/phT3lA0buauURBskNcfwYkA/JHQW3HqyzGHdHXG8REQd5D0j/H11Q9HrT 6CnQ== X-Forwarded-Encrypted: i=1; AJvYcCVci9Uzmvsy78jlM+VRwdGtgIs3Lbr6bGrn1cn/Z+AuMJYfQft7MpgL3mNIHTppewYXoOOKtb/dYVx1kZVY@postgresql.org X-Gm-Message-State: AOJu0YyEGUgabvsO48ftv/Q4GsIPwtOL8LfpV/Xa/Px9dMWjt7KE75tT 1LRUPitwgGpbPAnuvxZnU0KMq4Jwzj+UdjcM6KWCDdFy3ByT8509oGuPtgJw8/7g7iEZMSMkYXu F281/jgsG/qqkgRJx5/g1vWcscso= X-Google-Smtp-Source: AGHT+IECy7vwlItlVeOr/5c82FNF4aZkJjWjqg+iLIpwuJ8VYRoSB/XeOcmZKxvbf/7VtHbVfqhBY+n06VpRIZPY6vA= X-Received: by 2002:a05:6402:5213:b0:5c8:a2b8:cab3 with SMTP id 4fb4d7f45d1cf-5cbbf17f345mr8327309a12.4.1730122817254; Mon, 28 Oct 2024 06:40:17 -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> In-Reply-To: From: Alexander Korotkov Date: Mon, 28 Oct 2024 15:40:04 +0200 Message-ID: Subject: Re: Vacuum statistics To: Alena Rybakina Cc: Ilia Evdokimov , Andrei Zubkov , Alena Rybakina , pgsql-hackers , a.lepikhov@postgrespro.ru, jian he 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, Aug 25, 2024 at 6:59=E2=80=AFPM Alena Rybakina wrote: > I didn't understand correctly - did you mean that we don't need SRF if > we need to display statistics for a specific object? > > Otherwise, we need this when we display information on all database > objects (tables or indexes): > > while ((entry =3D ScanStatSnapshot(pgStatLocal.snapshot.stats, &hashiter)= ) > !=3D NULL) > { > CHECK_FOR_INTERRUPTS(); > > tabentry =3D (PgStat_StatTabEntry *) entry->data; > > if (tabentry !=3D NULL && tabentry->vacuum_ext.type =3D=3D type) > tuplestore_put_for_relation(relid, rsinfo, tabentry); > } > > I know we can construct a HeapTuple object containing a TupleDesc, > values, and nulls for a particular object, but I'm not sure we can > augment it while looping through multiple objects. > > /* Initialise attributes information in the tuple descriptor */ > > tupdesc =3D CreateTemplateTupleDesc(PG_STAT_GET_SUBSCRIPTION_STATS_COLS= ); > > ... > > PG_RETURN_DATUM(HeapTupleGetDatum(heap_form_tuple(tupdesc, values, nulls)= )); > > > If I missed something or misunderstood, can you explain in more detail? Actually, I mean why do we need a possibility to return statistics for all tables/indexes in one function call? User anyway is supposed to use pg_stat_vacuum_indexes/pg_stat_vacuum_tables view, which do function calls one per relation. I suppose we can get rid of possibility to get all the objects in one function call and just return a tuple from the functions like other pgstatfuncs.c functions do. ------ Regards, Alexander Korotkov Supabase