4.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 need to 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 to 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
The cfs_compression_ratio()
function returns the actual compression ratio 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.