postgres
Run PostgreSQL database server process
TLDR
Start PostgreSQL server
SYNOPSIS
postgres [-D datadir] [-p port] [-c name=value] [options]
DESCRIPTION
postgres is the PostgreSQL database server process. It manages database files, handles connections, and executes SQL queries.
The server is typically started through pg_ctl or system service managers rather than directly. Direct invocation is useful for debugging or non-standard configurations.
Configuration parameters can be set on command line or in postgresql.conf. Runtime parameters control memory, connections, logging, and behavior.
Single-user mode bypasses normal startup for maintenance. It's used for recovery operations when the database won't start normally.
The data directory contains all database files. It must be initialized with initdb before first use and is not portable between major versions.
Logging options help diagnose problems. Statement logging shows all SQL. Connection logging tracks client access.
PARAMETERS
-D DIR
Data directory.-p PORT
Port number.-c NAME=VALUE
Set runtime parameter.-h HOST
Listen addresses.-k DIR
Unix socket directory.-B BUFFERS
Shared buffers.-N N
Max connections.--single
Single-user mode.-F
Disable fsync.--describe-config
Describe configuration.--version
Show version.
CONFIGURATION
postgresql.conf
Main configuration file in the data directory controlling memory allocation, connection limits, logging, query planner settings, WAL behavior, and replication.pg_hba.conf
Host-based authentication file controlling which users can connect from which hosts using which authentication methods (trust, md5, scram-sha-256, cert).pg_ident.conf
User name mapping file for external authentication systems, mapping OS usernames to PostgreSQL roles.PGDATA
Environment variable specifying the data directory path, used as default when -D is not provided.
CAVEATS
Running directly bypasses service management. Data directory must be secure. Configuration affects performance significantly. Major version upgrades need pg_upgrade.
HISTORY
PostgreSQL development began at UC Berkeley in 1986 as POSTGRES (Post-Ingres). The open-source PostgreSQL project started in 1996. It's now one of the most advanced open-source databases.
