Dear Gunnar,
> 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?
Best Regards,
Hayato Kuroda
FUJITSU LIMITED