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 1nrIog-0004uJ-24 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 May 2022 12:30:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nrIod-0008Dv-Mr for pgsql-hackers@arkaria.postgresql.org; Wed, 18 May 2022 12:30:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrIod-0008Dm-9U for pgsql-hackers@lists.postgresql.org; Wed, 18 May 2022 12:30:11 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nrIoZ-0004Qo-Ut for pgsql-hackers@lists.postgresql.org; Wed, 18 May 2022 12:30:09 +0000 Received: by mail-il1-x131.google.com with SMTP id f9so1343259ils.7 for ; Wed, 18 May 2022 05:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PXJ1CLHAKkFmtXbImG0O58hOcJH9C8jZ3PI7rADXL9U=; b=HADIPkb0Ff5r0AGZUaLP9dtS9GUBxi8hjMashsavhWLcXgPndwK1dpuMdhljdn7g4n RQiJL2Skkz1u2TS3uMMDAGVbKGKkzEEM4v1yz44pUwZ8PWIQ6U8K0IXm7sCS2V6mFycn zqw6Z54TLr2YcjZ+OzQITR4UvzKJMrFsBcX5WwYmEPHQ7ftA63wbKXgCEUt6o93Ovt6x XbHI51+A9QzJ6gwgkWjVDvUAZiW+0ZSIUu33yDo1xBRlY06Nk9rE9rrekdNjyr5M1ahg Ncq4GxG+3U5TU/k93BKKrpEjFgykN1NEvFw3NzF8wQha4X/Sl/rX+5+6R0bAxnlnVucA 6A9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PXJ1CLHAKkFmtXbImG0O58hOcJH9C8jZ3PI7rADXL9U=; b=V/2LsMbE26nu3pHgIL6jehQxGEek0OWQWrEGFuAZSPhXs82GtvSRCzX6I0ST16vyak cX1zBt/7adj9UoxwK1jp1v+JtrROzx7zRtcbJ+sMsIRr4PEuO+rUGFVNpLHoDcn2W25z qDa2Dll/KNlscr5O8Be/5yxgIX1QOZkbJ23ULqKnE3phJEl6hDmA9LwhjZOpBaL9Yor6 XzUj4AXLZXTNS5t7TS0UEp3GEgTlg+kIwY2jysN1W/kXKRj2JU/BL6/NMUXH6WBf8CHc vaFpUfVp2ZCblREU2nb9rpKRi4N3/+MkU6a7xh7OR6jGdp+q2ACs8xV5GacW/EDooFR9 QY/A== X-Gm-Message-State: AOAM530d4n+h3q6eP+v2k9YSGyMmky5C+O144fV/PPOogYRKXls1dCgc yYWQTKDGp31Sos5Ir/uWI7mMiw== X-Google-Smtp-Source: ABdhPJxdFtWlIeim5SKiz1T/g7FGNT17TklNONSrI5gTrt1Z72oyssC9Gh6mJOFlKWci0x17sGdnWg== X-Received: by 2002:a05:6e02:18c8:b0:2cf:5266:ccf2 with SMTP id s8-20020a056e0218c800b002cf5266ccf2mr13967677ilu.207.1652877007085; Wed, 18 May 2022 05:30:07 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id n17-20020a056638265100b0032e21876ea8sm486903jat.72.2022.05.18.05.30.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 May 2022 05:30:06 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id C6221800C82; Wed, 18 May 2022 07:30:05 -0500 (CDT) Date: Wed, 18 May 2022 07:30:05 -0500 From: Justin Pryzby To: Alvaro Herrera Cc: Peter Eisentraut , Amit Langote , Japin Li , Zhihong Yu , Simon Riggs , pgsql-hackers@lists.postgresql.org, Tomas Vondra , Daniel Westermann , Erik Rijkers , Jaime Casanova , Andres Freund Subject: Re: support for MERGE Message-ID: <20220518123005.GA9638@telsasoft.com> References: <202203281100.qa7wqdu2ooyy@alvherre.pgsql> <202203281506.se4wtcvtvdq3@alvherre.pgsql> <20220511163350.GL19626@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220511163350.GL19626@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, May 11, 2022 at 11:33:50AM -0500, Justin Pryzby wrote: > I suggest to reference the mvcc docs from the merge docs, or to make the merge > docs themselves include the referenced information. No comments here ? > Also, EXPLAIN output currently looks like this: > > | Merge on ex_mtarget t (actual rows=0 loops=1) > | Tuples Inserted: 0 > | Tuples Updated: 50 > | Tuples Deleted: 0 > | Tuples Skipped: 0 > > Should the "zero" rows be elided from the text output ? > And/or, should it use a more compact output format ? > > There are two output formats already in use, so the options would look like > this: > > Tuples: Inserted: 1 Updated: 2 Deleted: 3 Skipped: 4 > or > Tuples: inserted=1 updated=2 deleted=3 skipped=4 > > Note double spaces and capitals. > That's separate from the question about eliding zeros. Actually, the existing uses suggest that these *aren't* separate. The cases where 0 output is elided (like Heap Blocks and Buffers) uses "=" and not ":". The cases using ":" always show all fields (Sort Method, Buckets, Hits, Batches). I'm not sure which is preferable for MERGE, but here's one way. diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index b902ef30c87..491105263ff 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -4119,10 +4119,20 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors, skipped_path = total - insert_path - update_path - delete_path; Assert(skipped_path >= 0); - ExplainPropertyFloat("Tuples Inserted", NULL, insert_path, 0, es); - ExplainPropertyFloat("Tuples Updated", NULL, update_path, 0, es); - ExplainPropertyFloat("Tuples Deleted", NULL, delete_path, 0, es); - ExplainPropertyFloat("Tuples Skipped", NULL, skipped_path, 0, es); + if (es->format == EXPLAIN_FORMAT_TEXT) + { + ExplainIndentText(es); + appendStringInfo(es->str, + "Tuples Inserted: %.0f Updated: %.0f Deleted: %.0f Skipped: %.0f\n", + insert_path, update_path, delete_path, skipped_path); + } + else + { + ExplainPropertyFloat("Tuples Inserted", NULL, insert_path, 0, es); + ExplainPropertyFloat("Tuples Updated", NULL, update_path, 0, es); + ExplainPropertyFloat("Tuples Deleted", NULL, delete_path, 0, es); + ExplainPropertyFloat("Tuples Skipped", NULL, skipped_path, 0, es); + } } }