Am 20.12.2021 um 04:20 schrieb kuroda.hay...@fujitsu.com:
Dear Gunnar,

Hi Kuroda-San!

postgres=# CREATE TABLE test (i int, lz4 text COMPRESSION lz4, std text);
postgres=# INSERT INTO test  SELECT
i,repeat(md5(i::text),100),repeat(md5(i::text),100) FROM
generate_series(0,100000) x(i);
postgres=# SELECT * FROM pg_stat_toast WHERE schemaname = 'public';
-[ RECORD 1 ]--------+----------
schemaname           | public
reloid               | 16829
attnum               | 2
relname              | test
attname              | lz4
externalizations     | 0
compressions         | 100001
compressionsuccesses | 100001
compressionsizesum   | 6299710
originalsizesum      | 320403204
-[ RECORD 2 ]--------+----------
schemaname           | public
reloid               | 16829
attnum               | 3
relname              | test
attname              | std
externalizations     | 0
compressions         | 100001
compressionsuccesses | 100001
compressionsizesum   | 8198819
originalsizesum      | 320403204

I'm not sure about TOAST, but currently compressions are configurable:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=bbe0a81db69bd10bd166907c3701492a29aca294

How about adding a new attribute "method" to pg_stat_toast?
ToastAttrInfo *attr->tai_compression represents how compress the data,
so I think it's easy to add.
Or, is it not needed because pg_attr has information?

That information could certainly be included in the view, grabbing the information from pg_attribute.attcompression. It probably should!

I guess the next step will be to include that view in the catalog anyway, so I'll do that next.

Thx for the feedback!
--
Gunnar "Nick" Bluth

Eimermacherweg 106
D-48159 Münster

Mobil +49 172 8853339
Email: gunnar.bl...@pro-open.de
__________________________________________________________________________
"Ceterum censeo SystemD esse delendam" - Cato


Reply via email to