DEV Community

Chiazam Ochiegbu
Chiazam Ochiegbu

Posted on

1

PostgreSQL Optimization: wal_buffers and wal_sync_method

wal_sync_method

This parameter defines the way Postgres will force WAL updates out to disk. By default the system will use “fdatasync”. However it is better to have it set to as “fsync_writethrough” if possible, it is considered to be safe and efficient.

random_page_cost

By default in Postgres, the random disk access is considered 4 times slower than sequence disk access. Base on this estimation, the query planner will decide whether it will be faster by using table scan than index scan or vice versa. Depending on the hardware, it is suggested to lower this number when fast disks are use, then query planner will have a higher chance to use index scan. With current hardware, most Postgres database administrators would prefer to have it with value of 2. However, in case a query planner is making bad decisions, this should not be the first place to look for answers. How autovacuum works is normally the factor that affects the decision of query optimizer.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay