Conversation
Clarify that 25% RAM is a starting point, not a strict rule. Recommend using pg_buffercache extension for workload-specific optimization. Add recent references for tuning methodology. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add references explaining PostgreSQL double buffering mechanism and how shared_buffers works with OS page cache. Clarify that effective_cache_size is for planner estimates only, with formula for starting point calculation. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add explicit warning about potential OOM kills in Kubernetes and cloud environments. Include worst-case calculation example showing how work_mem can multiply to 102GB. Add references for temp file monitoring and per-session tuning. Update recommendations with 2025 best practices and remove outdated 2011 reference. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add details about PostgreSQL version differences (1GB limit until v16, radix trees in v17+). Include autovacuum_max_workers multiply warning and reference to autovacuum_work_mem. Add AWS RDS autovacuum guide and 2025 best practices. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Clarify WAL recycling behavior and checkpoint triggering. Add recommendation to set max_wal_size for 1 hour of WAL with monitoring via pg_stat_bgwriter. Replace outdated 2016 reference with current best practices from official docs, EDB, Cybertec, and Crunchy Data. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add practical calculation example showing how 0.9 spreads writes over 4min 30s of a 5min interval. Include multiple monitoring resources for pg_stat_bgwriter. Replace outdated 2010 reference with current best practices and monitoring guides. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Set wal_buffers to 64MB for DW profile and 32MB for OLTP when shared_buffers > 8GB. Research shows these values can double performance for write-intensive systems vs auto-tune default. Add comprehensive table-driven tests covering all profiles and RAM sizes. Update documentation with profile-specific tuning recommendations and current best practices. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add security warnings for listen_addresses emphasizing localhost default and dangers of exposing to internet. Recommend specific IPs with pg_hba.conf or SSH tunnels. Expand max_connections guidance with connection pooling best practices. Include memory formula and PgBouncer references for high-concurrency scenarios. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Tune WAL sizes based on workload characteristics: - DW (Data Warehouse): 4GB/16GB for write-heavy batch jobs - OLTP: 2GB/8GB for frequent transactions - Web: 1GB/4GB for moderate writes - Mixed: 2GB/6GB for balanced workload - Desktop: 512MB/2GB for low activity Add comprehensive tests validating all profile configurations. Aligns with best practice of holding ~1 hour of WAL for most systems while accommodating different write patterns. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Set random_page_cost to 1.8 for DW profile on SSD/SAN storage, as analytical queries often touch >10% of rows where sequential scans are more efficient than index scans. Other profiles maintain 1.1 for SSD to favor index scans. Add comprehensive table-driven tests covering all profile and storage combinations. Update documentation with 2025 debate on plan stability vs SSD optimization, and guidance on when sequential scans become more efficient. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Clarify that parameter only affects bitmap heap scans and add context about when bitmap scans are used. Include note about PostgreSQL 18 default change from 1 to 16. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Clarify differences between worker, io_uring, and sync methods. Add recommendations on when to use each option and note that async I/O only affects reads in PostgreSQL 18. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add workload-specific recommendations for worker count based on CPU cores (10-40%). Explain when higher values are beneficial and how to monitor for saturation. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Clarify that parameter applies to VACUUM, CREATE INDEX, and ANALYZE. Add note about PostgreSQL 18 default change and relationship to effective_io_concurrency. Include workload-specific tuning references. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Clarify relationship between the two parameters and explain how larger values benefit sequential scans. Add note about PostgreSQL 18 requirement and data warehouse use cases. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add read-ahead formula and explain relationship with other I/O parameters. Note memory pressure concerns with high concurrency and benefits for high-latency storage. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Add recommendation to use clone method when filesystem supports it. Explain performance benefits (200-600ms for 100s of GB) and zero initial disk space consumption with CoW filesystems. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Explain worker pool concept and various consumers (parallel query, replication, extensions). Add recommendation to set based on CPU core count or at least 25% of vCPUs. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Explain resource multiplication effect (N workers = N+1x resources). Add references for parallel query tuning and analytics workload optimization. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Clarify system-wide limit and relationship with max_worker_processes. Add recommendation to set equal to CPU core count. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Scale worker parameters with CPU cores instead of using fixed values: - max_worker_processes: minimum 8 or CPU count - max_parallel_workers: minimum 8 or CPU count - max_parallel_workers_per_gather: 2 for transactional workloads (Desktop/Web/Mixed/OLTP), CPU/2 for DW (analytical workloads) Add comprehensive table-driven tests covering various CPU counts and workload profiles. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation Improvements (rules.yml)
Memory Parameters
pg_buffercacheextension for optimal tuning based on workload analysisRAM - shared_buffersWrite-Ahead Log (WAL) Parameters
Network Parameters
Storage Parameters (PostgreSQL 18+)
Worker Parameters
Code Optimizations
Checkpoint Tuning (checkpoint.go)
WAL Buffers Optimization:
WAL Size Optimization per Profile:
Storage Tuning (storage.go)
Random Page Cost Optimization:
I/O Concurrency (by disk type):
Async I/O Tuning (aio.go)
I/O Workers (by profile and disk type):
I/O Max Combine Limit:
I/O Max Concurrency:
Worker Configuration (worker.go)
Dynamic Scaling with CPU Cores:
max_worker_processes: max(8, TotalCPU)max_parallel_workers: max(8, TotalCPU)max_parallel_workers_per_gather:Testing
References Added
All documentation updates include authoritative references from:
Key Design Principles