Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nCxbw-0004Zp-Ku for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jan 2022 05:46:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nCxbu-0008Kw-CJ for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jan 2022 05:46:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nCxbt-0008Km-AG for pgsql-hackers@lists.postgresql.org; Thu, 27 Jan 2022 05:46:18 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nCxbm-0001Ha-CN for pgsql-hackers@postgresql.org; Thu, 27 Jan 2022 05:46:16 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A84735C018B; Thu, 27 Jan 2022 00:46:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 27 Jan 2022 00:46:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=X26YeI/3MJoShVh6BsR2JLZwrc0mNGhlZK1pOY 4lnZI=; b=3Irvju4s92GeXxF2RQ/CV5kwcfS958WdWjo95t1lJYYAb8CU7BIJhb 8bM0M/AAHO6y71gdKstxc+eTUCve5CwkvIuUsOTuRQJfiOph1DysPuBWx8gVLhNV NW2FfLfLa0TAUacPQRR0XpzpeCoxFTQXbWMbFlHJYxXyaQQm2X+id+yODcfWuo2J Ve3S65nHk2gB9ccuMMJL01ikpFHvpBXx4nlmPYYz95Z/rnychTUbF13UENgHcua+ WJeKhstqxEqb5haKbSl0YJDK0hyPyM9F8q4/54gHf0GcZaxVd0oPQPdG4FMwVLZ6 rdyNHo8I66kob1zSjqMGigvbwzZ8/sCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=X26YeI/3MJoShVh6B sR2JLZwrc0mNGhlZK1pOY4lnZI=; b=kFcDQjSOPb7/krbW+1r5xGLyVAPp8q4gJ IC92Bn22rjk5wE1SVS7IapYj5M+Vc0Q4t5UIMUASti5PKDElviKsmDkpXMwWWVUx WzVXtr2DQDNLdamouXkhOPp50u23fVWDvKJv5lVBdG+wXKdEg68zYVZmJquV/RNM 58DkUHf1j+Qgz6BN53DYcxKwidJZZzexyb6JjXVhv2WwDQEwCiPz24/g/1qPMn0x TzXD4ouWVRv0Vt59Jgn3PKM8+DhrC0CrRqY6WIwTDqvrE+ESzTfByUCZ8TlX9nWm VqdAxqNkKWCH5OBBJtOKZYWHWzF8c6Y/v29MNj24dSb+eNE7ADxzQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrfedvgdekjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeffhfeu ffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Jan 2022 00:46:08 -0500 (EST) Date: Wed, 26 Jan 2022 21:46:06 -0800 From: Andres Freund To: Masahiko Sawada Cc: pgsql-hackers@postgresql.org, Amit Kapila Subject: Re: Design of pg_stat_subscription_workers vs pgstats Message-ID: <20220127054606.7schba5oizo7jijf@alap3.anarazel.de> References: <20220125063131.4cmvsxbz2tdg6g65@alap3.anarazel.de> 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, I didn't quite get to responding in depth, but I wanted to at least respond to one point today. On 2022-01-25 20:27:07 +0900, Masahiko Sawada wrote: > > The pgstat entries are quite wide (292 bytes), because of the error message > > stored. That's nearly twice the size of PgStat_StatTabEntry. And as far as I > > can tell, once there was an error, we'll just keep the stats entry around > > until the subscription is dropped. > > We can drop the particular statistics by > pg_stat_reset_subscription_worker() function. Only if either the user wants to drop all stats, or somehow knows the oids of already dropped tables... > > Why isn't this just storing data in pg_subscription_rel? > > These need to be updated on error which means for a failed xact and we > don't want to update the system catalog in that state. Rightly so! In fact, I'm concerned with sending a pgstats message in that state as well. But: You don't need to. Just abort the current transaction, start a new one, and update the state. > There will be some challenges in a case where updating pg_subscription_rel > also failed too (what to report to the user, etc.). And moreover, we don't > want to consume space for temporary information in the system catalog. You're consuming resources in a *WAY* worse way right now. The stats file gets constantly written out, and quite often read back by backends. In contrast to parts of pg_subscription_rel or such that data can't be removed from shared_buffers under pressure. Greetings, Andres Freund