Hi,
On 12/13/2015 06:28 PM, Alexander Korotkov wrote:>
> Compression method of column would be stored in pg_attribute table.
> Dependencies between columns and compression methods would be tracked in
> pg_depend preventing dropping compression method which is currently in
> use. Compression method of the attribute could be altered by ALTER TABLE
> command.
>
> ALTER TABLE table_name ALTER COLUMN column_name SET COMPRESSION METHOD
> compname;
Do you plan to make this available in CREATE TABLE? For example
Greenplum allows to specify COMPRESSTYPE/COMPRESSLEVEL per column.
What about compression levels? Do you plan to allow tweaking them?
Tracking them would require another column in pg_attribute, probably.
> Since mixing of different compression method in the same attribute
> would be hard to manage (especially dependencies tracking), altering
> attribute compression method would require a table rewrite.
I don't think the dependency tracking would be a big issue. The easiest
we could do is simply track which columns used the compression type in
the past, and scan them when removing it (the compression type).
I think the main obstacle to make this possible is the lack of free
space in varlena header / need to add the ID of the compression method
into the value.
FWIW I'd like to allow this (mixing compression types), but I don't
think it's worth the complexity at this point. We can add that later, if
it turns out to be a problem in practice (which it probably won't).
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services