- basic architectural understanding required for understanding postgres performance in nontrivial loads - workload, OS, SSD vs. rotational, etc are playing a big role - shared memory, process based model - basic graph - shared_buffers is the biggest, sizewise, part of shared memory - backends are connected to shared memory, including shared_buffers - basic graph - executor wants to read something -> shared buffer hit/miss -> loaded from disk - executor/utility wants to write something -> shared buffer hit/miss -> loaded from disk -> *not* immediately written back - no free buffer -> clock sweep - write stuff back randomly -> corrupted on disk state - WAL logging - checkpoints - spread checkpoints - full page writes - checkpoint_segments, min_wal_size, max_wal_size - checkpoint_timeout - checkpoint_completion_target - WAL writer - tries to flush ahead of other backends - background writer - bgwriter_lru_maxpages, bgwriter_delay, bgwriter_lru_multiplier - limited effectiveness, not aggressive enough -- overview done -- - show flushing problems, including dirty bytes, writeback bytes - dirty_writeback/expire_centisecs, dirty_bytes/ratio, dirty_background_bytes/ratio - how to size shared buffers - large if entire working set fits - small if very frequent relation drops/reindexes - small if relation extension is very frequent - double buffering -- improvements - checkpoint sorting & flushing (9.6) - relation extension scalability (9.6) - buffer replacement scalability (9.5) - new bgwriter algorith (9.6, 9.7?) - different buffer mapping algorithm (radix tree) (9.7?) - better cache replacement algorithm - write combining during writeout - direct IO (?)