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 1kCcDX-00022M-4g for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 05:18:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kCcDV-00027a-Uk for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 05:18:53 +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 1kCcDV-00027O-Ni for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 05:18:53 +0000 Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kCcDT-0007qd-6m for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 05:18:52 +0000 Received: by mail-io1-xd44.google.com with SMTP id l8so4656436ios.2 for ; Sun, 30 Aug 2020 22:18:50 -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=kLSz53ggDu0kVVQU9HXmsIAfYJjMqTOzpXAwHd2Kmfo=; b=DnEpTFe7E/S41zxmlY1gwc3lxiv5sAHNnqX9EvpVYbUnvkIJju1ztukBZQeQGo1cHI Hbu1RfakQwCDrG5gRTtSqweOBl+6cGvXgSSx4wTwQPpdP+wY9S/TnCw3ggwSjKtnalFp xOMkvTWNVdaPVyiypYh6gmvn9kWz1XpWaRFafgqdNL5q4oLm5aZTDlTJcGtZ047FhmgL cKJHzDtBn70TlQVh0MRmIY2wnKZQk/85ygQrLFP3hmJ0ClnwFCDI3/PedZzJMzKwRxWS HB63XOBTYeIw+Ho2TLG85irc/ewf3kqMxlK36WIzSF5NfCwycTksehBTBomx0+FGY9He V+kw== 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=kLSz53ggDu0kVVQU9HXmsIAfYJjMqTOzpXAwHd2Kmfo=; b=Ophj1C7/zrIEzhrsxm+9a6VmEzcq2cUxt1C9H7aAPZVdxM3dAH/6YZcxD0PDiaUNOG cNjT+mN8bNrea5GaPQh7vilIyLiyCr6HHgR7pM0G11V7Vvtyi51sLNjcgnBN0VjoGZMq PxowlyJAa9JRjRG+nMUBVQA24QxHSwL2VtRhLFnZLVVIdKSI0SBGswCjUDOsr0wLE90D +89MHMW8zGG0jd8/rHWjuDywH1HvuDlzpZKi7S0qsD6xMEQUdkFS8EMDt7TRxEY8OFaf ML8GkMYb56sAyNbjR+mC0dMOf6fVrKQ9IfdzYcCgYDIF2zsBg1eFThJN0h3Qr+xypj6U nrCQ== X-Gm-Message-State: AOAM530MPakY4UgqxvB7XHjtVkzuaZ7SXMEiP2TwzsCqYHn5o1mYybGw fK/eeBHDbKHIghsV3s9wneRjJQ== X-Google-Smtp-Source: ABdhPJzMaNdouwUassdZ4ILTkw7+45LoqHSA6OMdbS4F7oIu2yulEkYm8I/jBlA9ceA9f1lVwwQq5A== X-Received: by 2002:a5d:9ac5:: with SMTP id x5mr7643115ion.111.1598851130116; Sun, 30 Aug 2020 22:18:50 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id j20sm3039980ilg.20.2020.08.30.22.18.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2020 22:18:49 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 4E4A7800A22; Mon, 31 Aug 2020 00:18:48 -0500 (CDT) Date: Mon, 31 Aug 2020 00:18:48 -0500 From: Justin Pryzby To: Alvaro Herrera Cc: Tatsuro Yamada , Julien Rouhaud , Pavel Stehule , pgsql-hackers@lists.postgresql.org, Tomas Vondra Subject: Re: list of extended statistics on psql Message-ID: <20200831051848.GH5450@telsasoft.com> References: <20200827235323.GA13919@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827235323.GA13919@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 Thu, Aug 27, 2020 at 07:53:23PM -0400, Alvaro Herrera wrote: > +1 for the general idea, and +1 for \dX being the syntax to use > > IMO the per-type columns should show both the type being enabled as > well as it being built. > > (How many more stat types do we expect -- Tomas? I wonder if having one > column per type is going to scale in the long run.) > > Also, the stat obj name column should be first, followed by a single > column listing both table and columns that it applies to. Keep in mind > that in the future we might want to add stats that cross multiple tables > -- that's why the CREATE syntax is the way it is. So we should give > room for that in psql's display too. There's also a plan for CREATE STATISTICS to support expresion statistics, with the statistics functionality of an expression index, but without the cost of index-update on UPDATE/DELETE. That's Tomas' patch here: https://commitfest.postgresql.org/29/2421/ I think that would compute ndistinct and MCV, same as indexes, but not dependencies. To me, I think it's better if there's a single column showing the "kinds" of statistics to be generated (stxkind), rather than a column for each. I'm not sure why the length of the stats lists cast as text is useful to show? We don't have a slash-dee command to show the number of MCV or histogram in traditional, 1-D stats in pg_statistic, right ? I think anybody wanting that would learn to SELECT FROM pg_statistic*. Also, the length of the text output isn't very meaningful ? If this is json, maybe you'd do something like this: |SELECT a.stxdndistinct , COUNT(b) FROM pg_statistic_ext_data a , json_each(stxdndistinct::Json) AS b GROUP BY 1 I guess stxdmcv isn't json, but it seems especially meaningless to show length() of its ::text, since we don't even "deserialize" the object to begin with. BTW, I've just started a new thread about displaying in psql \d the stats target of target extended stats. -- Justin