Type & function librarySQL-callable functions for every built-in data typesrc/backend/utils/adtSystem caches — src/backend/utils/cacheSystem cachessrc/…/cacheText stemmers — src/backend/snowballText stemmerssrc/backend/snowballApplicationAny program that opensa database connectionClient toolspsql, pg_dump and friends, all speaking libpqsrc/binInteractive psql — src/bin/psqlInteractivepsqlsrc/bin/psqlDump & restore — src/bin/pg_dumpDump & restoresrc/bin/pg_dumpGenerators & docsPerl scripts that synthesise headers and the SGMLmanualsrc/toolsDBA or developerTypes SQL and runsmaintenance toolsExtensionsContrib modules loaded into the backend as sharedlibrariescontribRemote tables — contrib/postgres_fdwRemote tablescontrib/postgres_fdwCrypto functions — contrib/pgcryptoCryptofunctionscontrib/pgcryptoInternal C APIHeaders and macros every backend file and extensioncompiles againstsrc/includefmgr ABI — src/include/fmgr.hfmgr ABIsrc/include/fmgr.hNode types — src/include/nodesNode typessrc/include/nodeslibpq client libraryBuilds the frontend/backend protocol and returnsresult setssrc/interfacesSend & fetch — src/interfaces/libpq/fe-exec.cSend & fetchsrc/…/fe-exec.cQuery buffers — src/interfaces/libpq/pqexpbuffer.cQuery bufferssrc/…/pqexpbuffer.cProcedural languagesHandlers that run PL/pgSQL, Perl, Python and Tclbodiessrc/plQuery engineParses, plans and executes each statement for onesessionsrc/backendParse & plan — src/backend/optimizer/planParse &plansrc/…/planDDL commands — src/backend/commandsDDLcommands…/commandsReport errors — src/backend/utils/errorReporterrorssrc/…/errorForeign PostgreSQLAnother server queried as foreign tablesHeap, WAL & buffersThe cluster on disk, read through a shared bufferpoolsrc/backend/storageBuffer cache — src/backend/storage/bufferBuffer cachesrc/…/bufferAccess methods — src/backend/accessAccess methodssrc/backend/accessRegression suitepg_regress plus the SQL and TAP tests it drivessrc/testSQL regress — src/test/regress/sqlSQL regresssrc/test/regress/sqlTAP driver — src/test/regressTAP driversrc/test/regressPG_GETARG / PG_RETURN macrosPQconnectdb, PQexecPQexec, PQgetvalue, PQclearruns generate-wait_event_types.…runs psql / pg_dumpereport, errmsg,fmgr callsGetConnection, libpq to…wire protocol on port 5432SPI_execute back into SQLcalls type & operator functionsloads shared libraryon CREATE…foreach, lfirst, list_lengthcalls the language handlertable_open, buffer reads/writestuples and index entriespg_regress feeds scripts to psqlPQenterPipelineMode testsONE PROCESS PER CLIENTCLIENT SIDEPrograms linked with libpq on a user's ownhostsrc/common and src/port are compiled into both the client toolsand the backend; they are not a separate process.FORKED PER CONNECTIONPOSTGRES BACKENDThe postgres server process and its shared buffersAutovacuum, WAL senders and other background workers share this code but are not drawn.SOURCE TREE ONLYBUILD & TESTPerl and SQL harnesses run from the checkoutNOT THIS INSTANCEOTHER SERVERSForeign PostgreSQL databases reached overthe wire
System map

How PostgreSQL runs

Key
Operation State / resource → Labelled direction → Main path More links ┄┄ Return path ┄ Inferred (dashed) ∘⋯ Starts a process (dotted)
Scroll or pinch to zoom · drag to pan