Re: unexpected result for wastedbytes query after vacuum full

Guillaume Lelarge <[email protected]> Wed, 11 Dec 2019 16:23:05 +0100
Newsgroups gmane.comp.db.postgresql.performance
Message-ID <CAECtzeX06VQq_rfYx+JiWpvUsoPvw03TqzThG8VYWdnwyn6FZQ@mail.gmail.com>
--0000000000003c2aea05996f3597
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Le mar. 10 d=C3=A9c. 2019 =C3=A0 20:48, Jeff Janes <[email protected]> a=
 =C3=A9crit :

> On Tue, Dec 10, 2019 at 11:43 AM Guillaume Lelarge <[email protected]=
o>
> wrote:
>
> This query uses the column statistics to estimate bloat. AFAIK, json
>> columns don't have statistics, so the estimation can't be relied on (for
>> this specific table at least).
>>
>
> This was true prior to 9.5 (for xml at least, I don't know about json),
> but should not be true from that release onward.  But still the differenc=
e
> between 74440704 and 74506240, this does seem to me to be straining at a
> gnat to swallow a camel.
>
>
I just checked, and you're right. There are less statistics with json, but
the important ones (null_frac and avg_width) are available for json and
jsonb datatypes. So the query should work even for tables using these
datatypes.

Thanks for the information, that's very interesting. And I apologize for
the noise.


--=20
Guillaume.

--0000000000003c2aea05996f3597
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail=
_attr">Le=C2=A0mar. 10 d=C3=A9c. 2019 =C3=A0=C2=A020:48, Jeff Janes &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt; a =C3=A9c=
rit=C2=A0:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div =
dir=3D"ltr"><div dir=3D"ltr">On Tue, Dec 10, 2019 at 11:43 AM Guillaume Lel=
arge &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">guilla=
[email protected]</a>&gt; wrote:</div><div dir=3D"ltr"><br></div><div class=
=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=
=3D"ltr"><div class=3D"gmail_quote"><div>This query uses the column statist=
ics to estimate bloat. AFAIK, json columns don&#39;t have statistics, so th=
e estimation can&#39;t be relied on (for this specific table at least).</di=
v></div></div></blockquote><div><br></div><div>This was true prior to 9.5 (=
for xml at least, I don&#39;t know about json), but should not be true from=
 that release onward.=C2=A0 But still=C2=A0the difference between=C2=A0<spa=
n style=3D"color:rgb(80,0,80)">74440704 and=C2=A0</span><span style=3D"colo=
r:rgb(0,0,0)">74506240</span>, this does seem to me to be straining at a gn=
at to swallow a camel.</div><div><br></div></div></div></blockquote><div><b=
r></div><div>I just checked, and you&#39;re right. There are less statistic=
s with json, but the important ones (null_frac and avg_width) are available=
 for json and jsonb datatypes. So the query should work even for tables usi=
ng these datatypes.</div><div><br></div><div>Thanks for the information, th=
at&#39;s very interesting. And I apologize for the noise.<br clear=3D"all">=
</div></div><div><br></div><div><br></div>-- <br><div dir=3D"ltr" class=3D"=
gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div>Guillaume.<br>=
</div></div></div></div></div></div>

--0000000000003c2aea05996f3597--