Re: [PATCH] pg_stat_toast v6

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: "Gunnar \"Nick\" Bluth" <gunnar(dot)bluth(at)pro-open(dot)de>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org, kuroda(dot)hayato(at)fujitsu(dot)com
Subject: Re: [PATCH] pg_stat_toast v6
Date: 2022-01-03 21:03:11
Message-ID: 20220103210311.GN24477@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> +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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-01-03 21:23:18 Re: [PATCH] pg_stat_toast v6
Previous Message Stanislav Bashkyrtsev 2022-01-03 20:26:32 Re: PostgreSQL stops when adding a breakpoint in CLion