Resource Usage / Kernel Resources

Master PostgreSQL kernel resource parameters. Learn optimal settings for file descriptor limits and system resource management for stable database operations.

max_files_per_process

  • What it does: Sets the maximum number of files that each PostgreSQL server process can have open simultaneously, controlling the per-process file descriptor limit within the database engine.
  • Why it matters: This parameter is crucial for preventing "too many open files" errors that can occur when database operations require accessing multiple files concurrently. Each PostgreSQL process may need to open data files, index files, temporary files, and system files simultaneously. Setting this too low can cause operations to fail unexpectedly, while setting it too high may potentially waste kernel resources or conflict with system-wide limits.
  • Ideal value & Best Practice: Default 1000 is reasonable for most standard workloads. For databases with many tables, indexes, or complex queries that access multiple relations, increase to 2000-4000. The value should be set slightly lower than your system's ulimit -n setting for the postgres user. Always ensure your system's global file descriptor limits are higher than this parameter. Monitor open file usage during peak operations to determine optimal settings for your specific workload.

Try pghealth Free Today πŸš€

Start your journey toward a healthier PostgreSQL with pghealth.
You can explore all features immediately with a free trial β€” no installation required.

πŸ‘‰ Start Free Trial