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 1lX515-000410-SL for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Apr 2021 16:38:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lX514-0004lA-Or for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Apr 2021 16:38:54 +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 1lX514-0004kx-Ds for pgsql-hackers@lists.postgresql.org; Thu, 15 Apr 2021 16:38:54 +0000 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lX50z-0003R6-KI for pgsql-hackers@postgresql.org; Thu, 15 Apr 2021 16:38:53 +0000 Received: by mail-il1-x12f.google.com with SMTP id i22so15990574ila.11 for ; Thu, 15 Apr 2021 09:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=/DoyqqJ4njcrLqta89WQjUImEJCbnHGbvcs5aqLb29Y=; b=tSNlNj34DmgNTaLUd3qwBB+S+kQKBYMRAdAIjVn2Ia35+ukMOzhwmCA3IDVK1aABKA QZdGMuqUnl8pfVSJOwoNMX/Qb4RbzgTtgNjPPFHDwJhYUhlrEoX6lNYECxqyHD7yraYC jhSPA8mKZntlbbjTQkd0mVYFc5u0CPXMbNTtdIhIGM0r3IsBuesAa2kxxy7g2sBtB23p kMtCuw8AB0UslzDvvSV3bwLd6Nh2EwwZMbhqHcI6dRLK7966zBu4W6M1NJskjq/mcpRx pXWcnOOqEMJMOGafB91FKs5x1vHikkneyI89CFxigxiigiP6zC7yiXWa53C7qKZxUNX/ F/Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=/DoyqqJ4njcrLqta89WQjUImEJCbnHGbvcs5aqLb29Y=; b=K1cxUMQIx4YMP6legDbCQdX+r5j19+oodN9qqMuMpSWp8ykTXty5MaNh5OCct9sdmQ AuVmYiQ5AsEc3fu/c6bOR1VjHwPL9v4xCMpJmkho0/cNRGEiiTKPbiJARHCx52wp/ptX VP2VzVR53IJU/BJVIl/yUNul0zhjHjf2Ys4qBR6a4Na9yaT/7tkA1vFQm8NKTh+SLLtD iZfL9+9jP1hcbYa36syOJWKEGSJzli2Mqjh2SX4LK+R1aKinKkT36PjhqQ23NeTshjus gMk7vr3z/k5X3otHe6w8011z8XsCalNIIdsBSIIvKLyFyTWskKuAdS4KPPQrJ9mgHV4W 4QCA== X-Gm-Message-State: AOAM532A82T305b/5p9nbHJsjZxjjWR9roN/VYg4XycBbB4ODnDALCmC Kva2GAcKXaTvnhYCN0nYD2kc8Q== X-Google-Smtp-Source: ABdhPJylOBT1fh/FMFbDPLr7N/8a8tyz4KlCJsbm8tuJsUi5sz6biD4xobTycTwmlG83yDZXqDGAlw== X-Received: by 2002:a92:bf11:: with SMTP id z17mr3631321ilh.146.1618504728616; Thu, 15 Apr 2021 09:38:48 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u6sm720216ill.78.2021.04.15.09.38.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Apr 2021 09:38:48 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 9E784800A3B; Thu, 15 Apr 2021 11:38:46 -0500 (CDT) Date: Thu, 15 Apr 2021 11:38:46 -0500 From: Justin Pryzby To: Andres Freund Cc: pgsql-hackers@postgresql.org Subject: wrong units in ExplainPropertyFloat Message-ID: <20210415163846.GA3315@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 |commit 7a50bb690b4837d29e715293c156cff2fc72885c |Author: Andres Freund |Date: Fri Mar 16 23:13:12 2018 -0700 | | Add 'unit' parameter to ExplainProperty{Integer,Float}. | | This allows to deduplicate some existing code, but mainly avoids some | duplication in upcoming commits. | | In passing, fix variable names indicating wrong unit (seconds instead | of ms). | | Author: Andres Freund | Discussion: https://postgr.es/m/20180314002740.cah3mdsonz5mxney@alap3.anarazel.de @@ -1304,8 +1299,8 @@ ExplainNode(PlanState *planstate, List *ancestors, planstate->instrument && planstate->instrument->nloops > 0) { double nloops = planstate->instrument->nloops; - double startup_sec = 1000.0 * planstate->instrument->startup / nloops; - double total_sec = 1000.0 * planstate->instrument->total / nloops; + double startup_ms = 1000.0 * planstate->instrument->startup / nloops; + double total_ms = 1000.0 * planstate->instrument->total / nloops; ... if (es->timing) { - ExplainPropertyFloat("Actual Startup Time", startup_sec, 3, es); - ExplainPropertyFloat("Actual Total Time", total_sec, 3, es); + ExplainPropertyFloat("Actual Startup Time", "s", startup_ms, + 3, es); + ExplainPropertyFloat("Actual Total Time", "s", total_ms, + 3, es); There's 3 pairs of these, and the other two pairs use "ms": $ git grep 'Actual.*Time' src/backend/commands/explain.c src/backend/commands/explain.c: ExplainPropertyFloat("Actual Startup Time", "s", startup_ms, src/backend/commands/explain.c: ExplainPropertyFloat("Actual Total Time", "s", total_ms, src/backend/commands/explain.c: ExplainPropertyFloat("Actual Startup Time", "ms", 0.0, 3, es); src/backend/commands/explain.c: ExplainPropertyFloat("Actual Total Time", "ms", 0.0, 3, es); src/backend/commands/explain.c: ExplainPropertyFloat("Actual Startup Time", "ms", src/backend/commands/explain.c: ExplainPropertyFloat("Actual Total Time", "ms", Text mode uses appendStringInfo() for high density output, so this only affects non-text output, but it turns out that units aren't shown for nontext format anyway - this seems like a deficiency, but it means there's no visible bug. -- Justin