For high-speed pgsql (on ZFS) enable zfs-compression (lz4) just on the filesystem, and disable zfs-caching (the arc, just leave metadata on) because postgres has it's own cache.
>ZFS-Dataset:
atime=off
compression=lz4
recordsize=8k
logbias=throughput
xattr=sa
redundant_metadata=most <===That's a maybe
primarycache=metadata
>In postgres:
full_page_writes=off <===That's a maybe
>Plus maybe some pgtune:
Alternative tuning guide: https://postgresqlco.nf/tuning-guide
(Disclosure: part of the team behind it)
You can still snapshot them atomically by making them both children of a parent dataset and performing a recursive snapshot on the parent. so you have dataset:
myservice/pgdata
myservice/pgwal
or
myservice/pgdata
myservice/pgdata/pgwal
or whatever.
So question, given that this article is about LZ4 memory compression for postgres, would you want it enabled for both/either/none of those datasets? Obviously compression-on-compression doesn't generally help at all, but lz4 performance obviously doesn't hurt much at all either, so if there's anything that postgres doesn't compress, maybe it would be faster in a few niche situations.
Well zfs probes and stops when the data is non compressible, that why stuff like mp3 gets not compressed, so if the pg-datas are already compressed zfs would try it and give it up after some kb's.
My understanding is that ZFS CoW makes torn pages impossible, so it's safe to turn off full page writes.
The same slides mention `primary_cache` and the suggestion is use `metadata` if db working set fits in RAM and use the default of `all` if it doesn't.
[0]: https://people.freebsd.org/~seanc/postgresql/scale15x-2017-p...
No, postgres know better what to cache then arc.
Unless your read operations to the file system are somehow very cheap, I don't think disabling toast compression is a good idea.
You don’t have to do anything. Toast compression is enabled for compatible types by default but never kicks in until a cell hits 2K bytes in size (by default).