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 1nM4qn-0008HW-J6 for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Feb 2022 09:19: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 1nM4qm-0003Wh-DA for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Feb 2022 09:19:20 +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 1nM4qm-0003WY-3k for pgsql-hackers@lists.postgresql.org; Mon, 21 Feb 2022 09:19:20 +0000 Received: from mail-yb1-xb35.google.com ([2607:f8b0:4864:20::b35]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nM4qf-0005O0-QN for pgsql-hackers@postgresql.org; Mon, 21 Feb 2022 09:19:19 +0000 Received: by mail-yb1-xb35.google.com with SMTP id w63so11669830ybe.10 for ; Mon, 21 Feb 2022 01:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TYJeZC9XKX+qSBWlF3zsHGqHimJQnWkXW2PP02Kfdow=; b=ptG1n4K92RxYPOe84Yd3Rt4uLDEsLBiJN9R63OiPk8kd+MJ/0GuyWs23pOnp5bqziQ ChhM+6TEp1FJfWgopWHBHGXWrw08kK859bjKPSfhQmQx156K2Jh5N7rGPjULBSGKXDdN Rl2PK2C2zIBTCFHK81dXUgW5TtXwyrevbWaLw31oEEnLMlHLjbGnhfxtVHMCqVv6XhLN 4wK/uecVV6/piTM3iWx0jdYamkXKCt4T43o68GGfjN/l2aVCF3yW86sI+3x5ua7k6gVo zmGfl8liccUfFSddWgvMrJl1wqDf0fC6bCs9/Wv4u9hICkWNhInyqPzhJqsek3xQZ95Y KxJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TYJeZC9XKX+qSBWlF3zsHGqHimJQnWkXW2PP02Kfdow=; b=UXkG6TAVJnUUESdgp3RDy1O6Xc+5oqD0aHzcWZw9pMkJ+Aoo7MqMG2hpKf7oSKbhJ5 ct3NlKizisPFSdpOjr2oaKBfz+ejrdi/A26NIeldpUehr7ChGqYEPxNCfrkoo+wKkXSK HyMJlBGzIO6fqBkf9bmQWlD+ikV3HR3iEwvlE3gSfEbaDBR4BUAv7jd783IxD74E/bOi YcNqV7Qavt9Q2EfGWHYctrQeo9cVWULXP90R+iHIaQm/uSUW/ZfGmkwN/j1tnI8yrGsm bCU1rKRr9p7dAtY+s51gavKYazApdKk5t2++krWEG6+Jrfg63degnSXPBJ0I7fflNP0W zOfw== X-Gm-Message-State: AOAM531mkghNXJITg35gxUmJVwDIJiiBPtWdvx4UeQKYFBvxBv985DUr TT/xzBZw9byun+H4RPI07/z4n4IkE+2alIKdF/0= X-Google-Smtp-Source: ABdhPJzkE1NL8d54XqMO2TCAiOjEmo6m6IatMGUKEArko84qdwSza9c9WDxcZTdLEQY202r8dm/K87kctlQ/yR74vMc= X-Received: by 2002:a25:d2c3:0:b0:623:f9ef:62c3 with SMTP id j186-20020a25d2c3000000b00623f9ef62c3mr17530790ybg.495.1645435152008; Mon, 21 Feb 2022 01:19:12 -0800 (PST) MIME-Version: 1.0 References: <20220215182641.2cejma6tcgeoqyw2@alap3.anarazel.de> <20220218203255.d3evl6qi2n6gxy6b@alap3.anarazel.de> <20220219160203.y5w2ktc2utthn7pe@alap3.anarazel.de> <20220221053453.lo6fzmji23ennvgj@alap3.anarazel.de> <20220221074806.nyhdberpuwbcbudp@alap3.anarazel.de> In-Reply-To: <20220221074806.nyhdberpuwbcbudp@alap3.anarazel.de> From: Amit Kapila Date: Mon, 21 Feb 2022 14:49:01 +0530 Message-ID: Subject: Re: Design of pg_stat_subscription_workers vs pgstats To: Andres Freund Cc: Masahiko Sawada , "David G. Johnston" , pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Feb 21, 2022 at 1:18 PM Andres Freund wrote: > > On 2022-02-21 12:39:31 +0530, Amit Kapila wrote: > > Fair enough. Then, how about the following keeping the following information: > > Mostly sounds good. > > > > * subid (subscription id) > > * subname (subscription name) > > Coming from catalog, via join, I assume? > The subname would be from pg_subscription catalog similar to what we are doing now for pg_stat_subscription_workers. > > > * sync_error_count/sync_failure_count (number of timed table sync failed) > > * apply_error_count/apply_failure_count (number of times apply failed) > > Yep. > > > > * sync_success_count (number of table syncs successfully finished) > > This one I'm not quite convinced by. You can't rely on precise counts with > pgstats and we should be able to get a better idea from somewhere more > permanent which relations succeeded? But it also doesn't do much harm, so ... > We can get precise information from pg_subscription_rel (rels that are in ready/finish_copy state) but OTOH, during refresh some of the rels would have been dropped or if a user creates/refreshes publication with copy_data = false, then we won't get information about how many table syncs succeeded? I have also kept this to make the sync information look consistent considering we have sync_failure_count. > > > * apply_commit_count (number of transactions applied successfully) > > * apply_rollback_count (number of transactions explicitly rolled back) > > What does "explicit" mean here? > It is for the Rollback Prepared case and probably for streaming of in-progress transactions that eventually get rolled back. > > > * stats_reset (Time at which these statistics were last reset) > > > > The view name could be pg_stat_subscription_lrep, > > pg_stat_logical_replication, or something on those lines. > > pg_stat_subscription_stats :) > Having *stat* two times in the name sounds slightly odd to me but let us see what others think. One more option could be pg_stat_subscription_replication. -- With Regards, Amit Kapila.