Every instance will be different but generally speaking the default settings that PostgreSQL has will be Ok to start with but once the instance has been running for a few months the amount of data being stored will mean things start to bog down and some tuning is needed.
https://pgtune.leopard.in.ua will give you a good starting point.
What we use on piefed.social, with 4 CPU cores and 8 GB of RAM is:
synchronous_commit = off
wal_writer_delay = 2000ms
max_connections = 200
shared_buffers = 1GB
effective_cache_size = 4GB
maintenance_work_mem = 1GB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 10MB
huge_pages = off
min_wal_size = 1GB
max_wal_size = 3GB
max_worker_processes = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
max_parallel_maintenance_workers = 2
That’s pretty much the same as what pgtune suggested except work_mem is a bit bigger.
Save this text in a file at /etc/postgresql/14/main/conf.d/piefed.conf.
The “14” part of that path will vary depending on your postgresql version.