> +pgstat_report_toast_activity(Oid relid, int attr,
> +                                                     bool externalized,
> +                                                     bool compressed,
> +                                                     int32 old_size,
> +                                                     int32 new_size,
...
> +             if (new_size)
> +             {
> +                     htabent->t_counts.t_size_orig+=old_size;
> +                     if (new_size)
> +                     {

I guess one of these is supposed to say old_size?

> +             &pgstat_track_toast,
> +             false,
> +             NULL, NULL, NULL
> +     },
>       {

> +CREATE TABLE toast_test (cola TEXT, colb TEXT COMPRESSION lz4, colc TEXT , 
> cold TEXT, cole TEXT);

Is there a reason this uses lz4 ?
If that's needed for stable results, I think you should use pglz, since that's
what's guaranteed to exist.  I imagine LZ4 won't be required any time soon,
seeing as zlib has never been required.

> +        Be aware that this feature, depending on the amount of TOASTable 
> columns in
> +        your databases, may significantly increase the size of the 
> statistics files
> +        and the workload of the statistics collector. It is recommended to 
> only
> +        temporarily activate this to assess the right compression and 
> storage method
> +        for (a) column(s).

saying "a column" is fine

> +       <structfield>schemaname</structfield> <type>name</type>
> +       Attribute (column) number in the relation
> +       <structfield>relname</structfield> <type>name</type>

> +      <entry role="catalog_table_entry"><para role="column_definition">
> +       <structfield>compressmethod</structfield> <type>char</type>
> +      </para>
> +      <para>
> +       Compression method of the attribute (empty means default)

One thing to keep in mind is that the current compression method is only used
for *new* data - old data can still use the old compression method.  It
probably doesn't need to be said here, but maybe you can refer to the docs
about that in alter_table.

> +       Number of times the compression was successful (gained a size 
> reduction)

It's more clear to say "was reduced in size"

> +     /* we assume this inits to all zeroes: */
> +     static const PgStat_ToastCounts all_zeroes;

You don't have to assume; static/global allocations are always zero unless
otherwise specified.


Reply via email to