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 1kDcRr-000697-Ke for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2020 23:45:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDcRp-0007kR-Me for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2020 23:45:49 +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 1kDcRp-0007kK-FL for pgsql-hackers@lists.postgresql.org; Wed, 02 Sep 2020 23:45:49 +0000 Received: from dish-sg.nttdocomo.co.jp ([202.19.227.74]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDcRi-0008LR-Ua for pgsql-hackers@lists.postgresql.org; Wed, 02 Sep 2020 23:45:45 +0000 X-dD-Source: Outbound Received: from zssg-mailmd103.ddreams.local (zssg-mailmd900.ddreams.local [10.160.172.63]) by zssg-mailou102.ddreams.local (Postfix) with ESMTP id 0612A120103; Thu, 3 Sep 2020 08:45:39 +0900 (JST) Received: from t113sg-mailcc12.ddreams.local (t113sg-mailcc12.ddreams.local [100.66.13.87]) by zssg-mailmd103.ddreams.local (dDREAMS) with ESMTP id <0QG200AGP202OL30@dDREAMS>; Thu, 03 Sep 2020 08:45:38 +0900 (JST) Received: from t113sg-mailcc12 (localhost [127.0.0.1]) by t113sg-mailcc12.ddreams.local (unknown) with SMTP id 082NjcLm061604; Thu, 3 Sep 2020 08:45:38 +0900 Received: from zssg-mailmf103.ddreams.local (unknown [127.0.0.1]) by zssg-mailmf103.ddreams.local (Postfix) with ESMTP id 577CF7E6036; Thu, 3 Sep 2020 08:45:22 +0900 (JST) Received: from zssg-mailmf103.ddreams.local (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54E3D8E6058; Thu, 3 Sep 2020 08:45:22 +0900 (JST) Received: from localhost (unknown [127.0.0.1]) by IMSVA (Postfix) with SMTP id 5363C8E6054; Thu, 3 Sep 2020 08:45:22 +0900 (JST) X-IMSS-HAND-OFF-DIRECTIVE: localhost:10026 Received: from zssg-mailmf103.ddreams.local (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7AF08E6058; Thu, 3 Sep 2020 08:45:21 +0900 (JST) Received: from zssg-mailua103.ddreams.local (unknown [10.160.172.62]) by zssg-mailmf103.ddreams.local (Postfix) with ESMTP; Thu, 3 Sep 2020 08:45:21 +0900 (JST) Received: from [10.132.149.160] (unknown [10.160.179.1]) by zssg-mailua103.ddreams.local (dDREAMS) with ESMTPA id <0QG200E621ZHRD30@dDREAMS>; Thu, 03 Sep 2020 08:45:17 +0900 (JST) Subject: Re: list of extended statistics on psql References: <20200831153053.a343pjgumahiejhw@development> <20200831161809.GA31337@alvherre.pgsql> <20200831163200.jp6eqbaaupb6hxac@development> From: Tatsuro Yamada Message-id: Date: Thu, 03 Sep 2020 08:45:17 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=utf-8; format=flowed Content-language: en-US Content-transfer-encoding: 8bit X-TM-AS-GCONF: 00 To: Pavel Stehule , Tomas Vondra Cc: Alvaro Herrera , Julien Rouhaud , PostgreSQL Hackers X-CC-Mail-RelayStamp: CC/Mail Relayed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, > >> I wonder if trying to list info about all stats from the statistics > >> object in a single line is necessary. Maybe we should split the info > >> into one line per statistics, so for example > >> > >>     CREATE STATISTICS s (mcv, ndistinct, dependencies) ON ... > >> > >> would result in three lines in the \dX output. The statistics name would > >> identify which lines belong together, but other than that the pieces are > >> mostly independent. > > > >Yeah, that's what I'm suggesting.  I don't think we need to repeat the > >name/definition for each line though. > > > >It might be useful to know how does pspg show a single entry that's > >split in three lines, though. > > > > Ah, I didn't realize you're proposing that - I assumed it's broken > simply to make it readable, or something like that. I think the lines > are mostly independent, so I'd suggest to include the name of the object > on each line. The question is whether this independence will remain true > in the future - for example histograms would be built only on data not > represented by the MCV list, so there's a close dependency there. > > Not sure about pspg, and I'm not sure it matters too much. > > > pspg almost ignores multiline rows - the horizontal cursor is one row every time. There is only one use case where pspg detects multiline rows - sorts, and pspg ensures correct content for multiline rows displayed in different (than input) order. I try to summarize the discussion so far. Is my understanding right? Could you revise it if it has something wrong? * Summary 1. "\dX[+]" doesn't display the Size of extended stats since the size is useful only for the development process of the stats. 2. each row should have stats name, definition, type, and status. For example: statname | definition | type | ----------+------------------+---------------------------+ someobj | (a, b) FROM tab | n-distinct: built | someobj | (a, b) FROM tab | func-dependencies: built | someobj | (a, b) FROM tab | mcv: built | sttshoge | (a, b) FROM hoge | n-distinct: required | sttshoge | (a, b) FROM hoge | func-dependencies:required| sttscross| (a, b) FROM t1,t2| n-distinct: required | My opinion is below: For 1., Agreed. I will remove it on the next patch. For 2., I feel the design is not beautiful so I'd like to change it. The reasons are: - I think that even if we expected the number of types increasing two times, each type would be better to put as columns, not lines. Repeating items (the stats name and definition) should be removed. It's okay there are many columns in the future like "\df+" because we can use "\x" mode to display if we need it. - The type column has two kinds of data, the one is stats type and another is status. We know the word "One fact in One place" for data modeling in the RDBMS world so it would be better to divide it. I'd like to suggest the bellow design of the view. statname | definition | n-distinct | func-dependencies | mcv | ----------+------------------+------------+-------------------+-------| someobj | (a, b) FROM tab | built | built | built | sttshoge | (a, b) FROM hoge | required | required | | sttscross| (a, b) FROM t1,t2| required | | | Any thoughts? Thanks, Tatsuro Yamada