Re: Move pg_attribute.attcompression to earlier in struct for reduced size?

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org, Dilip Kumar <dilipbalaut@gmail.com>, Robert Haas <robertmhaas@gmail.com>
Date: 2021-05-26T01:57:00Z
Lists: pgsql-hackers
On Tue, May 25, 2021 at 08:33:47PM -0500, Justin Pryzby wrote:
> It reminds me of reltablespace, which is stored as 0 to mean the database's
> default tablespace.
> 
> Also, values are currently retoasted during vacuum full if their column's
> current compression method doesn't match the value's old compression.
> 
> But it doesn't rewrite the column if the it used to use the default
> compression, and the default was changed.  I think your idea would handle that.

Ah, the parallel with reltablespace and default_tablespace at database
level is a very good point.  It is true that currently the code would
assign attcompression to a non-zero value once the relation is defined
depending on default_toast_compression set for the database, but
setting it to 0 in this case would be really helpful to change the
compression methods of all the relations if doing something as crazy
as a VACUUM FULL for this database.  Count me as convinced.
--
Michael

Commits

  1. Remove forced toast recompression in VACUUM FULL/CLUSTER

  2. Rethink definition of pg_attribute.attcompression.

  3. Fix memory leak when de-toasting compressed values in VACUUM FULL/CLUSTER

  4. Re-order pg_attribute columns to eliminate some padding space.

  5. Add more TAP tests for pg_dump with attribute compression