Source code structure postgresql

bootstrap - create the initial database template by initdb

almost Postgre SQL every operating system will need to access the table, how to create these system tables it? These systems can not create a table and insert data in the usual way, because the table creation and insertion requirements of system tables already exist. The purpose of this part of the code is to use a special method of using only during the bootstrap system tables to direct

main - or transfer control to the postmaster postgres
inspection process name (argv [0]), and various flags, and passes control or the postmaster postgres

postmaster - postgres server control initiation / termination
create a shared memory, and then enters a loop waiting for a connection request. When a connection request arrives, start a postgres background service process, connect it transferred

libpq - backend server libpq library function
communications between the client process and the process

tcop - to dispatch the request to the appropriate module
which is the main postgres background service process processing section, it calls the parser, optimizer, executor, and function commands in the

parser - SQL query into a query tree
from the libpq the SQL query into a command in the form of a structure for optimizer / executor or commands using the first SQL statements. lexical analysis, converted into keywords, identifiers, and constants, then parsing. Parsing command structure generation in the form to indicate the composition of the query. Then the structure is separated in the form of a command, checks and transmits commands to the processing of the function, or is converted to the node list for process optimizer and executor

optimizer - create a query path and query plan
to use parser output to generate optimized for the executor query plan.

Optimizer / path - using the parser output to create a query path
that uses parser output to generate all possible execution method, connect it checklist order, where clause to limit and table statistics optimizer to evaluate every possible execution methods, and each method gives a cost of

optimizer / geqo - genetic algorithms query optimization
optimizer / path connection table for all methods were evaluated. However, when the number of the table becomes large, the number of detected measurement also becomes large. Genetic Algorithm optimization for each query table consideration, and then calculate the optimal order to perform connection. If only a few tables, this method takes a long time, but for a large number of tables, this method is relatively fast. The system has an option for controlling when using this function

optimizer / plan - to optimize the output path
for the output selected expense optimizer / path is the path of least and create an implementation plan

optimizer / prep - handle specific query plan
for a particular query plan process

optimizer / util - optimizing support functions
functions for the optimizer to use of other parts of the

executor - to perform complex node forms from the optimizer's query plan
. processing select, insert, update, and delete statements operations to deal with these statements include heap scan, index scan, sort, connection table, the packet is calculated and set function of processing

commands - executor execution command does not require
Do not have to deal with complex SQL commands, including vacuum, copy, alter, create table , create type , and many other commands fail exemplified. Generated by the parser structure used when calling the function of this part of the code most do some processing, and then calls the low-level functions in the catalog number of the directory to do the actual work.

Catalog - operating system directory
that contains the operating system tables and directories for a function of a function to create and manipulate tables, indexes, procedures, operator, type, and set functions can be found here. They are the low-level function, usually formatted by the upper layer request to invoke a function of the user pre-formatted

storage - various types of storage system management
support server to access resources in a unified manner

storage / buffer - shared buffer management
storage / file - the file management
storage / ipc - lights and shared memory
storage / large_object - large object
storage / lmgr - lock Manager
storage / page - page Manager
storage / smgr - storage / disk Manager

access - a variety of access methods
to support heap , index, and access to the transaction data

access / common - public access function
access / gist - customizable access method
access / the hash - the hash
access / heap - heap for access table
access / index - All index the type of use
access / nbtree - btree management algorithm Lehman and Yao's
access / rtree - 2-dimensional data for the index
access / transam - Transaction Manager (BEGIN / ABORT / COMMIT)

Nodes - create / manipulate nodes and the list
PostgreSQL SQL query to said memory a structure node. Node is a generic container, which contains a type field and a data field with the type of node generally strung list.

. List element contains a pointer and a next linked list node and widely used parser, optimizer, executor and used to store data and requests

utils - Supporting Program
utils / adt - built-in data types
include all data types PostgreSQL comes

utils / cache - system / relation / function cache
PostgreSQL supports custom data types, data type is not among the cured core. It will go into the system tables when the server needs to find a data type. Because the system frequently used tables, so setting up a cache to speed up the search. The system includes a systematic relationship cache, a function / operator relationship information cache cache and a relationship information cache contains information about all recently visited the table, not just the system tables contain information

utils / error - error report
to the front desk report background error

utils / fmgr - manager function
processing calls dynamic loading function and functions defined in the system call table

utils / hash - hash program used internally
And a cache memory manager to quickly find a dynamic data structure stored

utils / init - various initialization
utils / misc - unclassified Eastern
utils / mmgr - Memory Manager (process private memory)
the PostgreSQL explicit memory the context allocate memory context can be a statement-level, transaction level or permanent / global level so, back-end server can easily when a statement or end of a transaction free up memory.

utils / the Sort - sort
in memory or use a disk file Sort

utils / time - transaction limited time
to check whether a tuple is still valid, or is uncommitted transactions, or has been replaced by a new line

include - include files
for each subsystem has a directory

lib - libraries support
several common procedures

regex - the regular expression library
regular expression as the backend server for processing '~'.

the rewrite - rule system
finishes processing rules of the system

tioga - 

Guess you like

Origin www.cnblogs.com/itsad/p/11599140.html
Recommended