Postgresql version: 13.1
The Postgresql directory structure is:
The directory where the source code is stored is the src directory. The specific directory functions are as follows:
aclocal.m4 : part of the file used for config, including .m4 files
config.log : config definition file
configure:configure 文件
configure.in : The prototype of the configure file
COPYRIGHT : copyright information
GUNMakefile : Makefile of the first level directory
GUNMakefile.in : The prototype of Makefile
HISTORY : Modification history
INSTALL : Brief description of installation method
Makefile : Makefile copy
README : Brief description
doc/ : document directory
contrib/ : contribution program
config/ : The directory of files used by config
src/ : source code directory
The following explains the postgresql-13.1/src directory:
The src directory is as follows:
The directory where the backend code is stored is the backend directory, which is also the most important directory. The specific catalog is explained as follows:
backend/: the source directory of the backend
include/: header files, backend and other code header files are included in include. Although its organization is similar to the backend's directory structure, it is not exactly the same. Basically, the sub-directories of the next level no longer have the next level of directories.
common/ : Common library code
bin/: code for UNIX command tools such as psql
pl/: Code of stored procedure language
port/: platform porting related code
template/: platform-related setting values
test/: various test scripts
timezone/: time zone related code
tools/: respective development tools and documentation
tutorial/ : Tutorial
fe_utils/ : General tools
interfaces/: front-end related library code
makefiles/: platform-related make settings
Makefile:Makefile
Makefile.global: Make settings (generated from configure)
Makefile.global.in: The prototype of Makefile.global used by Configure
Makefile.port: platform-related make settings, actually a connection to makefile/Makefile. (generated from configure)
Makefile.shlib: Makefile for shared libraries
nls-global.mk: Rules for Makefile files used in the information directory
DEVELOPERS: Notes for developers
The following explains the main directory postgresql-13.1/src/ backend directory:
Backend directory structure:
access/ : various storage access methods (under each subdirectory) common (common function), gin (Generalized Inverted Index), gist (Generalized Search Tree general index), hash (hash index), heap (heap) Access method), index (universal index function), nbtree (Btree function), transam (transaction processing)
bootstrap/ : Initialization of the database (when initdb)
catalog/ : system catalog
commands/ : SELECT/INSERT/UPDATE/DELETE thought of SQL text processing
executor/ : executor (execution of access)
foreign/ : FDW (Foreign Data Wrapper) processing
lib/ : general functions
libpq/ : front-end/back-end communication processing
main/ : the main function of postgres
nodes/ : processing functions related to the structure tree nodes
optimizer/ : optimizer
parser/ : SQL composition parser
po/ : language file configuration
port/ : platform-related code
postmaster/ : The main function of postmaster (resident postgres)
regex/ : regular processing
replication/:streaming replication
rewrite/ : Rewrite processing related to rules and views
snowball/ : Full-text search related (stem processing)
storage/ : shared memory, storage on disk, cache, etc. all primary/secondary record management (the following directories) buffer/(cache management), file/(file), freespace/(Fee Space Map management) ipc/(process Inter-communication), large_object/(access function of large object), lmgr/(lock management), page/(page access related function), smgr/(storage manager)
tcop/ : The main part of postgres (database engine process)
tsearch/ : Full-text search
utils/ : various modules (the following directories) adt/(embedded data types), cache/(cache management), error/(error handling), fmgr/(function management), hash/(hash function), init/( Database initialization, initial postgres processing), mb/ (multi-byte word processing), misc/ (other), mmgr/ (memory management function), resowner/ (data in query processing (buffer pin and table lock) Management), sort/ (sort processing), time/ (MVCC management of affairs)
Makefile :makefile
nls.mk : nls makefile
common.mk : common makefile file
postgres : executable file, the main running program