Le mar. 10 déc. 2019 à 20:48, Jeff Janes <jeff.janes@xxxxxxxxx> a écrit :
On Tue, Dec 10, 2019 at 11:43 AM Guillaume Lelarge <guillaume@xxxxxxxxxxxx> 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 difference 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.
Guillaume.