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 1l1969-0001NS-Pz for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Jan 2021 14:32:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1967-0005tY-V8 for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Jan 2021 14:32:07 +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 1l1967-0005tO-Js for pgsql-hackers@lists.postgresql.org; Sun, 17 Jan 2021 14:32:07 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l1963-0007iC-Si for pgsql-hackers@lists.postgresql.org; Sun, 17 Jan 2021 14:32:06 +0000 Received: by mail-ed1-x52c.google.com with SMTP id u19so14747317edx.2 for ; Sun, 17 Jan 2021 06:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8mLnU45v6puh682RSBxqcgtNigk0V1D6AjoukVsYRRg=; b=JkDTvMd6RjeXPqOAphLJ6lCAnXLqXoNuPCrGwD+FlvBD0VTen0kJRNzEnAIWVFtXzw fNaZyxLs16GUhYU9DZGylyAWrkW8wDh7iT7Rt7YLw7VSBMqXVpZ2KNzdeQD/Vzrp93vX fCQJfsbeR8S8giRQb+gYCx0K+F3EV5T0Y4LprhyxpSlmnoyoXqDiH72F0xOq7Aqnzwgk NZ+aWQKTGlCPCyyAN5jT8L4t6jaVbxaFZeGFcxCJfXgbHfcFJdE44YMVzpTliyxF2fBX dHbMgYI3cEHi+fGc/WwyIO5w7u4Up5uH/rjlLS9B8eS5QNyrBSw+Fowg+5CaStiMdM1u C+Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8mLnU45v6puh682RSBxqcgtNigk0V1D6AjoukVsYRRg=; b=EhKoVGTEPZgytD01p/rG29RoD1s+Jm4o4Ji/ubFGJt/2KO+iihBCs0rh+zlom6r+8c 2Ry73VdLXTrLCqSz9+hYiFzcj/3HprSVVBm7D1FAxXDAZVIJXottc424Swv/Cz1ZzxMm bekxJvnRW/ZEX1oLgQNH/rEtDldtSAa2E6XvwLB+NYhDtcb4lXxJ+owsFa4NWgpcLBqS 0/oriha6NvSr+td7ngUFtjK+PFE0zBXiztCBu4sLtQB3iUNkf6Frm1WZP7Ly7D3NQgLa B/cTfNXNROL2jC8IgbqNKuYVW1xYhUuOsoHP4TyyHHoLQQdQS9xDtA6Pj1Kf9cBSyE2d sfgQ== X-Gm-Message-State: AOAM5300lXxaY2EskCODeHXy1auaY+eyegCjIgzglmC1mXpIkRoQ2wfl 3tDvTJVeBvW4S5BCIiVsdth2KADuW0Rz8RwQpTPXGvKi3xLv2fb3LDJJoIgBsMNHUvIO6/yG0dd D9Pbe/vqzleR91Sde3qOW/wiI9lkI5MhnGAGQ2BRA/FTwCvEzWn/ebn09lCW/oGfxM+782/q2g2 95/GWSng1j+A0eaiQHiozvPzCXru22jGmLdrspM1d0Csx/q3eMRBfpOvZY+DyRHeD2cfAcl+X3d aEB9kdQiXjWy4VKwP9Y+hX3lL2tXzhQRjWihv26WH/yjnMNpp+DgQ== X-Google-Smtp-Source: ABdhPJxKEetz8QgOml8o/txuxD9gmahLSipbSeQjbKIM63h8q2gWzOZKg2CAiamLsflfGQ5q3lR7jg== X-Received: by 2002:a05:6402:4d6:: with SMTP id n22mr16808741edw.27.1610893921797; Sun, 17 Jan 2021 06:32:01 -0800 (PST) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id d4sm9506461edq.36.2021.01.17.06.32.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Jan 2021 06:32:00 -0800 (PST) Subject: Re: list of extended statistics on psql To: "Shinoda, Noriyoshi (PN Japan FSIP)" , Julien Rouhaud , Tatsuro Yamada Cc: Alvaro Herrera , Tomas Vondra , Michael Paquier , Pavel Stehule , PostgreSQL Hackers References: <20210107144713.GA8872@alvherre.pgsql> <61cba5af-5a58-6bda-610c-420077b780c3@enterprisedb.com> <1045d2cb-7ecd-e6bf-cb50-8eeea89cc4b0@nttcom.co.jp_1> <9e76ce7a-e7ab-5f08-9938-59fffc20d106@enterprisedb.com> <29e16ceb-8777-4297-19c8-245242dd7473@enterprisedb.com> <876efa7e-2067-a4f9-d7e8-f6025440c870@nttcom.co.jp_1> <0e84aa72-25f2-1849-753f-f827949132b3@enterprisedb.com> <85e7e1e7-c2f0-a4a0-61de-6e7ecaee44e3@nttcom.co.jp_1> <79d3a4c5-1efe-5b9e-c06e-3a907b531013@nttcom.co.jp_1> <20210115084741.GA91293@nol> <2eb51458-7475-17d3-cb13-b3c950b2f930@enterprisedb.com> <5e0fb573-3c38-ee39-885c-bdc01f116335@enterprisedb.com> From: Tomas Vondra Message-ID: Date: Sun, 17 Jan 2021 15:31:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/17/21 3:01 AM, Tomas Vondra wrote: > On 1/17/21 2:41 AM, Shinoda, Noriyoshi (PN Japan FSIP) wrote: >> Hi, hackers. >> >> I tested this committed feature. >> It doesn't seem to be available to non-superusers due to the inability >> to access pg_statistics_ext_data. >> Is this the expected behavior? >> > > Hmmm, that's a good point. Bummer we haven't noticed that earlier. > > I wonder what the right fix should be - presumably we could do something > like pg_stats_ext (we can't use that view directly, because it formats > the data, so the sizes are different). > > But should it list just the stats the user has access to, or should it > list everything and leave the inaccessible fields NULL? > I've reverted the commit - once we find the right way to handle this, I'll get it committed again. As for how to deal with this, I can think of about three ways: 1) simplify the command to only print information from pg_statistic_ext (so on information about which stats are built or sizes) 2) extend pg_stats_ext with necessary information (e.g. sizes) 3) create a new system view, with necessary information (so that pg_stats_ext does not need to be modified) 4) add functions returning the necessary information, possibly only for statistics the user can access (similarly to what pg_stats_ext does) Options 2-4 have the obvious disadvantage that this won't work on older releases (we can't add views or functions there). So I'm leaning towards #1 even if that means we have to remove some of the details. We can consider adding that for new releases, though. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company