Chapter
Chapter 1: PostgreSQL Versions
Performance of historical PostgreSQL releases
Choosing a version to deploy
Upgrading to a new major version
PostgreSQL or another database?
Finding contrib modules on your system
Installing a contrib module from source
Using a PostgreSQL's Extensions
Additional PostgreSQL related software
PostgreSQL application scaling life cycle
Performance tuning as a practice
Chapter 2: Database
Hardware
Balancing hardware spending
Hardware and software RAID
Recommended disk controllers
Attached storage - SAN and NAS
Reliable controller and disk setup
[Hard drive reliability studies]
Hard drive reliability studies
Sources of write-back caching
Disk controller monitoring
Disabling drive write caches
Performance impact of write-through caching
Chapter 3: Database Hardware Benchmarking
CPU and memory benchmarking
STREAM and Intel versus AMD
Sources of slow memory and processors
Physical disk performance
Random access and I/O per second
Sequential access and ZCAV
Basic disk benchmarking using HD Tune
Measuring IOPS using HD Tune
Unpredictable performance and Windows
Disk throughput in case of sequential read and write
Complicated disk benchmarks
Disk-performance expectations
Sources of slow disk and array performance
Filesystem crash recovery
Drive support for barriers
Filesystem support for barriers
General Linux filesystem tuning
Read caching and swapping
Solaris and FreeBSD filesystems
Adjusting mounting behaviour
Disk layout for PostgreSQL
Disk arrays, RAID, and disk layout
Chapter 5: Memory for Database Caching
Memory units in the postgresql.conf file
Increasing UNIX shared memory parameters for larger buffer sizes
Estimating shared memory allocation
Inspecting the database cache
Installing pg_buffercache into a database
Creating a new block in a database
Writing dirty blocks to disk
Crash recovery and the buffer cache
Checkpoint processing basics
Write-ahead log and recovery processing
Database buffer cache versus operating system cache
Platform, version, and workload limitations
Analyzing buffer cache contents
Inspection of the buffer cache queries
Top relations in the cache
Buffer contents summary with percentages
Buffer usage count distribution
Using buffer cache inspection for sizing feedback
Chapter 6: Server Configuration Tuning
Interacting with the live configuration
Defaults and reset values
Reloading the configuration file
log_min_duration_statement
default_statistics_target
checkpoint_completion_target
commit_delay and commit_siblings
max_prepared_transactions
Dedicated server guidelines
Chapter 7: Routine Maintenance
Transaction visibility with multiversion concurrency control
Visibility computation internals
Transaction ID wraparound
Returning free disk space
Common vacuum and autovacuum problems
Autovacuum is running even though it was turned off
Autovacuum is constantly running
Not keeping up on a busy server
Autovacuum is too disruptive
Long-running transactions
Free space map exhaustion
Recovering from major problems
Vacuuming the database/table
Detailed data and index page monitoring
Basic PostgreSQL log setup
Using syslog for log messages
Logging difficult queries
Normalized query fingerprints
Chapter 8: Database Benchmarking
Configuring the database server for pgbench
Sample server configuration
Graphing results with pgbench-tools
Configuring pgbench-tools
Sample pgbench test results
TPC-B-like test (Read/Write)
Sources for bad results and variation
Developer PostgreSQL builds
Worker threads and pgbench program limitations
Transaction processing performance council benchmarks
Chapter 9: Database Indexing
Indexing example walkthrough
Measuring query disk and index block statistics
Lookup with an inefficient index
Planning for plan changes
Clustering against an index
Explain with buffer counts
Index creation and maintenance
Concurrent index creation
Indexing for full-text search
Chapter 10: Query Optimization
Hot and cold cache behavior
Query plan node structure
Estimated costs and real-world costs
Machine readable explain output
Bitmap heap and index scans
Subquery scan and subplan
Subquery conversion and IN lists
Nested loop with inner-index scan
Nested Loop and Merge Join materialization
Viewing and estimating with statistics
Adjusting a column target
Difficult areas to estimate
Other query planning parameters
Executing other statement types
Optimizing for fully cached datasets
Testing for query equivalence
Disabling optimizer features
Working around optimizer bugs
Avoiding plan restructuring with OFFSET
Using window functions for numbering
Using window functions for cumulatives
Chapter 11: Database Activity and Statistics
Cumulative and live views
Decoding lock information
Monitoring Buffer, background writer, and checkpoint activity
Saving pg_stat_bgwriter snapshots
Tuning using background writer statistics
Chapter 12: Monitoring and Trending
Examples of good performance
Overloaded system samples
Enabling sysstat and its optional features
Saving Windows system monitor data
Types of monitoring and trending software
Storing historical trend data
Chapter 13: Pooling and Caching
Pooling connection counts
Application server pooling
Chapter 14: Scaling with Replication
Replication queue managers
Read scaling with replication queue software
Special application requirements
Other interesting replication projects
Replications solution comparison
Chapter 15: Partitioning Data
Partitioning in PostgreSQL
Determine a key field to partition over
Redirecting INSERT statements to the partitions
Dynamic trigger functions
Empty partition query plans
Date change update trigger
Live migration of a partitioned table
Common partitioning mistakes
Horizontal partitioning with PL/Proxy
Chapter 16
: Database Profiling
Linux SystemTap emulation of DTrace
Chapter 17: Avoiding Common Problems
External loading programs
Skipping WAL acceleration
Recreate indexes and add constraints
Common performance issues
Slow function and prepared statement execution
High foreign key overhead
Heavy statistics collector overhead
Targeted statistics resets
Chapter 18: Performance Features by Release
Aggressive PostgreSQL version upgrades
Performance features in version 8.1
Performance features in version 8.2
Performance features in version 8.3
Performance features in version 8.4
Performance features in version 9.0
Configuration and monitoring
Performance features in version 9.1
Performance features in version 9.2
Performance features in version 9.3
Performance features in version 9.4
Performance features in version 9.5
Performance features in version 9.6