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 1rmDze-006jfD-A4 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Mar 2024 14:29:38 +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 1rmDzc-002bqb-PH for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Mar 2024 14:29:37 +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 1rmDzc-002bqT-Fk for pgsql-hackers@lists.postgresql.org; Mon, 18 Mar 2024 14:29:36 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rmDza-005C9W-Cs for pgsql-hackers@lists.postgresql.org; Mon, 18 Mar 2024 14:29:36 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6e69a77f41dso191032a34.3 for ; Mon, 18 Mar 2024 07:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710772172; x=1711376972; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wx79DbbXAPc7fynOdGdxyvrN9dncIYHA7s4/npV7tVA=; b=TzKZlsNB65s3YNEh+LRdzE9OIM7/dwfsTYhyBNDUiLXZjg750bbfhGJN6KgYkrTCWf i8LxTfgYRV273ZExaZElTCBNTv36Cal1PSEigNml6Lx53Y+WittJ+NKIPPCI+S1ZjEd5 4F1t1j2kpYi4YruV1VTNyZ9K9ABuStoP0LC1v99qBE5WrbMvcnu2+a1uj3OnznfejaSM 7zbZGhxcRHjwR6ruaGpcEi/EobNVJlHElBkaLvyZlAtuzWjeHa3n9WvVHUaRyx6YESmJ f9YeUuaRljunFVm6INTOKDnaTQOjmkkCpXIrvNiy4btXDKvcPqX9S0myai/7UNaY+yF/ ujZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710772172; x=1711376972; h=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=wx79DbbXAPc7fynOdGdxyvrN9dncIYHA7s4/npV7tVA=; b=h5ktzc0Zb+IMLeKe4LRSkMaG64fNXVggvbi0/a7fHbSHXebYAin8Eb0+1gDv3MEzeQ ZfRqJwJkGYnGe6tazw+eHpIajHAlwKywgN3NtJAAIiGhAJMnJ//6rL6n7b7gkDbFzn1K eEnIJJDuFmIUQJabiBIPw0F/9hsNYf1w2Ttf65BhT/DqDjLgV2MG1IUBoo/FMSAeg1+6 OlAg1r5VBuHz7uBMoA1aGBlYJ4cX6s9gbixsvYeB5BGfv9mLe6hC2UUo9LGTBUmpHGw6 Ldtp8mNn/QVyRDBm03Qw8uCbYA8sPtCLpCBDajhX1DR/38o+5XLQDDGNonkjVig2xaTQ cNGw== X-Forwarded-Encrypted: i=1; AJvYcCUxelp4YyrD3curbb90uv+huOXsc662xGhREpg125rWeBskOdDygysJ5pMfEhuL91brsZCVb7C0XU1dp5jk906XVK2wkFBFjElRpPuw0zwlQVcG X-Gm-Message-State: AOJu0YzYOG48ZvchOQN+q+JMt80CSc2fFvZ1CbkwRSdNFeuwFEYYqcSo xuJ+L2u9aaHNm95BEChYyWiXaRfGF8VL7guVnmHoJmFpRhaUpwkKOg8vl+OHLuMMrEOE23naYQK LxjEMRvlfiR2aGcn6J0FP/PrjKnc= X-Google-Smtp-Source: AGHT+IGK0/KgynvPdkYIyuxlIDHCRSZA5AdmlXAKhvpfqCXmTSlV36K+vwgue7NovmIfwgb2O0OlpBltYYP6OLpc/9s= X-Received: by 2002:a05:6871:14e:b0:222:9076:45d7 with SMTP id z14-20020a056871014e00b00222907645d7mr10105117oab.41.1710772172432; Mon, 18 Mar 2024 07:29:32 -0700 (PDT) MIME-Version: 1.0 References: <2838538.1705692747@sss.pgh.pa.us> <3791430.1705943243@sss.pgh.pa.us> <3831858.1705959108@sss.pgh.pa.us> <3511300.1708112330@sss.pgh.pa.us> <2506269.1710514705@sss.pgh.pa.us> <2982030.1710609907@sss.pgh.pa.us> <3127158.1710685722@sss.pgh.pa.us> <3399753.1710704359@sss.pgh.pa.us> In-Reply-To: <3399753.1710704359@sss.pgh.pa.us> From: Dean Rasheed Date: Mon, 18 Mar 2024 14:29:21 +0000 Message-ID: Subject: Re: Improving EXPLAIN's display of SubPlan nodes To: Tom Lane Cc: Aleksander Alekseev , pgsql-hackers@lists.postgresql.org, Chantal Keller Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 17 Mar 2024 at 19:39, Tom Lane wrote: > > Here's a cleaned-up version that seems to successfully resolve > PARAM_EXEC references in all cases. I haven't changed the > "(plan_name).colN" notation, but that's an easy fix once we have > consensus on the spelling. I took a more detailed look at this and the code and doc changes all look good to me. There's a comment at the end of find_param_generator() that should probably say "No generator found", rather than "No referent found". The get_rule_expr() code could perhaps be simplified a bit, getting rid of the show_subplan_name variable and moving the recursive calls to get_rule_expr() to after the switch statement -- if testexpr is non-NULL, print it, else print the subplan name probably works for all subplan types. The "colN" notation has grown on me, especially when you look at examples like those in partition_prune.out with a mix of Param types. Not using "$n" for 2 different purposes is good, and I much prefer this to the original "FROM [HASHED] SubPlan N (returns ...)" notation. > There are two other loose ends bothering me: > > 1. I see that Gather nodes sometimes print things like > > -> Gather (actual rows=N loops=N) > Workers Planned: 2 > Params Evaluated: $0, $1 > Workers Launched: N > > I propose we nuke the "Params Evaluated" output altogether. +1 > 2. MULTIEXPR_SUBLINK subplans now result in EXPLAIN output like > > -> Result > Output: (SubPlan 1).col1, (SubPlan 1).col2, (SubPlan 1), i.tableoid, i.ctid > > The undecorated reference to (SubPlan 1) is fairly confusing, since > it doesn't correspond to anything that will actually get output. > I suggest that perhaps instead this should read > > Output: (SubPlan 1).col1, (SubPlan 1).col2, IGNORE(SubPlan 1), i.tableoid, i.ctid > > or > > Output: (SubPlan 1).col1, (SubPlan 1).col2, RESET(SubPlan 1), i.tableoid, i.ctid I think "RESET()" or "RESCAN()" or something like that is better than "INGORE()", because it indicates that it is actually doing something. I don't really have a better idea. Perhaps not all uppercase though, since that seems to go against the rest of the EXPLAIN output. Regards, Dean