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 1kEfP0-0004Vb-Ry for pgsql-hackers@arkaria.postgresql.org; Sat, 05 Sep 2020 21:07: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 1kEfOz-0005gy-BG for pgsql-hackers@arkaria.postgresql.org; Sat, 05 Sep 2020 21:07:13 +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 1kEfOy-0005gr-Vg for pgsql-hackers@lists.postgresql.org; Sat, 05 Sep 2020 21:07:13 +0000 Received: from mail-il1-x144.google.com ([2607:f8b0:4864:20::144]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kEfOq-0003Og-JG for pgsql-hackers@postgresql.org; Sat, 05 Sep 2020 21:07:12 +0000 Received: by mail-il1-x144.google.com with SMTP id b17so9364266ilh.4 for ; Sat, 05 Sep 2020 14:07:02 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=008ShKW9qGnolV/Tbzy1qGjDyazIkCwE0qjgRBDfPAU=; b=f9vbinNM1l9FLns3k4XuOe97fezifQzNV5mNh+HU6PibxoJoc2EA3LRXEJb4IK6nEC U2soeKWb5cHcF43gY2GdNn9vOWmm9tc1z6SfZDydAAtrQ/cV6YBpOzTAHPyboNGuS/xf og8Px0vZ5Y54RjgDl5txC/ADTM2QQiKE2Pd0Yor/gZk3T9AYXKjDAvfKhzKA+B8mDODe Ycv+1piozB3zIHNqk/oNwEb0PKX9iXkpdm01i9rlS7fjeqyQ2cLSad1BQ5R+yt5df8O/ xn1DdO3GierQ2YkKgdjfkGvbiVec1YUkSMBN5PNlrEadaL0H4+ZMUxDiGyhokDxb0OAE un6w== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=008ShKW9qGnolV/Tbzy1qGjDyazIkCwE0qjgRBDfPAU=; b=GFCg1UQcCqp/iJhI6t7uvS/hUe1+CtwGde/cCN/cPtpFn1mU18QnmabxfUIJbsQLl2 Kh4l9XoHhRDe3yLBSsgYZ0NYiQGH3iZuzB5pXG5DpwkyHuizMwWG7AMMy7yibJJiXl6s DL9H+yXW3ubo9TgaBwNM7tTitUu5gswxhsbhHKL1aXjLeBpYE97ERBSnxJ+U3vACNgrO mxJ36Nl4d3ZPMBBgbfRlWmh1JtvM/7uoO8R11Kz2SmvPmXU0j29EqFffuImeguk7EU4j 068cAfu3XEYPoI+v6r/qo++GxqabbcaNcWWfJdxsiitVCa3/U0xJgUABzoXxC0jqqBNw tQzQ== X-Gm-Message-State: AOAM533q/zUcrTju6KlJHXdHUUc8KwoK/6Lp0F4hIj119rH/8Svft71A Uz8kuAJsPbvW9iuIRQgVe2M+BQ== X-Google-Smtp-Source: ABdhPJwrDnYf4ssRFgrMtx5go6f/YMXNuRV84uUTtCMaSfZOxJxpJI8npt8Is7/nLRKCVw9DaAH4dg== X-Received: by 2002:a92:5f04:: with SMTP id t4mr13396161ilb.299.1599340021103; Sat, 05 Sep 2020 14:07:01 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p124sm4700010iof.19.2020.09.05.14.06.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Sep 2020 14:06:59 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id C59888005ED; Sat, 5 Sep 2020 16:06:58 -0500 (CDT) Date: Sat, 5 Sep 2020 16:06:58 -0500 From: Justin Pryzby To: Alvaro Herrera Cc: gkokolatos@pm.me, pgsql-hackers@postgresql.org, Tomas Vondra , Tatsuro Yamada Subject: Re: v13: show extended stats target in \d Message-ID: <20200905210658.GA6744@telsasoft.com> References: <20200901011429.GZ5450@telsasoft.com> <20200901210825.GA20170@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200901210825.GA20170@alvherre.pgsql> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Sep 01, 2020 at 05:08:25PM -0400, Alvaro Herrera wrote: > +1 on fixing this, since the ability to change stats target is new in > pg13. > > On 2020-Aug-31, Justin Pryzby wrote: > > > Maybe it should have a comma, like ", STATISTICS %s"? > > It does need some separator. Maybe a comma is sufficient, but I'm not > sure: that will fail when we add cross-relation stats, because the > FROM clause will have more relations and possibly have commas too. Good thought. You said it'll "fail", but I guess you mean it could be confusing to look at. I didn't actually know that "multiple tables" were planned for MV stats. Another consideration is expression stats (as compared with expression indexes). I don't see how that helps guide this decision at all, though. I think trying to parse \d output is discouraged and a bad idea, but it's obviously not ok if the output is ambiguous. But it's not ambiguous, since STATISTICS is capitalized and unquoted. Arguably, "nn" could be construed as looking like a table alias, which doesn't make sense here, and integer aliases would also need to be quoted (and seem unlikely and not useful). ... FROM t1, t2, STATISTICS nn I think this is 1) unambiguous; 2) clear; 3) consistent with other output and with the "ALTER STATISTICS SET STATISTICS NN" command. It could say "SET" but I don't think it's useful to include; 4) seems to reasonably anticipate future support for expressions and multiple tables; I'm happy if someone suggests something better, but I don't know what that would be. Unless we hurried up and finished this for v13, and included stxstattarget. https://commitfest.postgresql.org/29/2692/ https://www.postgresql.org/message-id/flat/c0939aba-3b12-b596-dd08-913dda4b40f0%40nttcom.co.jp_1#32680b2fe0ab473c58a33eb0f9f00d42 Maybe it's not relevant, but I found these don't have a separator. ppendPQExpBufferStr(&buf, " DEFERRABLE"); ppendPQExpBufferStr(&buf, " INITIALLY DEFERRED"); ppendPQExpBufferStr(&buf, " INVALID"); ppendPQExpBufferStr(&buf, " PRIMARY KEY,"); ppendPQExpBufferStr(&buf, " REPLICA IDENTITY"); ppendPQExpBufferStr(&buf, " UNIQUE,"); ppendPQExpBufferStr(&buf, " UNIQUE CONSTRAINT,"); ppendPQExpBufferStr(&buf, " CLUSTER"); ppendPQExpBufferStr(&buf, " AS RESTRICTIVE"); ppendPQExpBuffer(&buf, "\n TO %s", These look like the only similar things with more than a single separator: ppendPQExpBuffer(&buf, "\n USING (%s)", ppendPQExpBuffer(&buf, "\n WITH CHECK (%s)", -- Justin