Compress PostgreSQL Database
File system

A very popular method of doing this is with the file system. BTRFS and ZFS works under the database at the file system level. Both can be used in a loopback device so you can provide a compressed tablespace without having another partition. There are caveats with this, if the tablespace fails it may take your cluster too.

ZFS

ZFS is the big one here. It's what I would go for.

See also


https://blog.2ndquadrant.com/pg-phriday-postgres-zfs/
https://blogs.oracle.com/observatory/zfs-compression-a-win-win (popular on Oracle too)


Btrfs

Btrfs is a strong contender but it's been in active development for a very long time, and the lack of major distros picking it up as a default has many people questioning whether or not it's ready for "prime time."


https://btrfs.wiki.kernel.org/index.php/Compression


PostgreSQL

GIS Methods (PostGIS)


For Polygons, one method is to simplify polygons by dropping vertices with ST_Simplify.
For Points, one method is spatial clustering.


Both of these result in a loss of information. PostGIS, like most of the features of the database, doesn't have a transparent "magic compression" option.

cstore_fdw

There is also cstore_fdw which is a columnar store that offers compression. It has a different performance profile so ymmv.