5.2. CFS (Compressed File System)

CFS enables page level compression in Shardman. Compression can only be enabled for separate tablespaces. To compress a tablespace, you should enable the compression option when creating this tablespace. For example:

        CREATE TABLESPACE data LOCATION '/mnt/data-{rgid}' WITH (global, compression='zlib');
      

Now you can create tables and indexes in this tablespace or move existing table or index into it.

CREATE TABLE pgbench_branches (
       bid integer NOT NULL PRIMARY KEY USING INDEX TABLESPACE data,
       bbalance integer,
       filler character(88)
)
WITH (distributed_by = 'bid') TABLESPACE data;
      

Note

Function cfs_compression_ratio() returns real compression ration for all segments of the compressed relation. However, it returns NaN for partitioned and foreign tables, so it works only for local partitions of a sharded table.

Complete CFS documentation can be found here.