From 97b1bb228135dee3770ea0dd1db39d85e239030c Mon Sep 17 00:00:00 2001
From: Bruce Momjian
Date: Wed, 29 Oct 1997 23:48:18 +0000
Subject: New backend_dir html source.
---
src/tools/backend/README | 3 +
src/tools/backend/backend_dirs.html | 420 ++++++++++++++++++++++++++++++++++++
src/tools/backend/flow.fig | 140 ++++++++++++
src/tools/backend/flow.gif | Bin 0 -> 674098 bytes
src/tools/backend/index.html | 42 ++++
5 files changed, 605 insertions(+)
create mode 100644 src/tools/backend/README
create mode 100644 src/tools/backend/backend_dirs.html
create mode 100644 src/tools/backend/flow.fig
create mode 100644 src/tools/backend/flow.gif
create mode 100644 src/tools/backend/index.html
(limited to 'src/tools/backend')
diff --git a/src/tools/backend/README b/src/tools/backend/README
new file mode 100644
index 00000000000..601c66cc4bc
--- /dev/null
+++ b/src/tools/backend/README
@@ -0,0 +1,3 @@
+Just point your browser at the index.html file, and click on the
+flowchart to see the description and source code.
+
diff --git a/src/tools/backend/backend_dirs.html b/src/tools/backend/backend_dirs.html
new file mode 100644
index 00000000000..3ef940f0ca1
--- /dev/null
+++ b/src/tools/backend/backend_dirs.html
@@ -0,0 +1,420 @@
+
+
+PostgreSQL Backend Directories
+
+
+
+PostgreSQL Backend Directories
+
+
+by Bruce Momjian
+
+
+
+bootstrap
+- creates initial template database via initdb
+
+
+Because PostgreSQL requires access to system tables for almost every
+operation, getting those system tables in place is a problem.
+You can't just create the tables and insert data into them in the normal way,
+because table creation and insertion requires the tables to already
+exist.
+This code jams the data directly into tables using a
+special syntax used only by the bootstrap procedure.
+
+
+
+main
+- passes control to postmaster or postgres
+
+
+This checks the process name(argv[0]) and various flags, and passes
+control to the postmaster or postgres backend code.
+
+
+
+postmaster
+- controls postgres server startup/termination
+
+
+This creates shared memory, and then goes into a loop waiting for
+connection requests.
+When a connection request arrives, a postgres backend is started,
+and the connection is passed to it.
+
+
+
+libpq
+- backend libpq library routines
+
+
+This handles communication to the client processes.
+
+
+
+tcop
+- traffic cop, dispatches request to proper module
+
+
+This contains the postgres backend main handler, as well as the
+code that makes calls to the parser, optimizer, executor, and
+/commands functions.
+
+
+
+parser
+- converts SQL query to query tree
+
+
+This converts SQL queries coming from libpq into command-specific
+structures to be used the the optimizer/executor, or /commands
+routines.
+The SQL is lexically analyzed into keywords, identifiers, and constants,
+and passed to the parser.
+The parser creates command-specific structures to hold the elements of
+the query.
+The command-specific structures are then broken apart, checked, and passed to
+/commands processing routines, or converted into Lists of
+Nodes to be handled by the optimizer and executor.
+
+
+
+optimizer
+- creates path and plan
+
+
+This uses the parser output to generate an optimal plan for the
+executor.
+
+
+
+optimizer/path
+- creates path from parser output
+
+
+This takes the parser query output, and generates all possible methods of
+executing the request.
+It examines table join order, where clause restrictions,
+and optimizer table statistics to evaluate each possible execution
+method, and assigns a cost to each.
+
+
+
+optimizer/geqo
+- genetic query optimizer
+
+
+optimizer/path evaluates all possible ways to join the requested tables.
+When the number of tables becomes great, the number of tests made
+becomes great too.
+The Genetic Query Optimizer considers each table separately, then figures
+the most optimal order to perform the join.
+For a few tables, this method takes longer, but for a large number of
+tables, it is faster.
+There is an option to control when this feature is used.
+
+
+
+This takes the optimizer/path output, chooses the path with the
+least cost, and creates a plan for the executor.
+
+
+
+optimizer/prep
+- handle special plan cases
+
+
+This does special plan processing.
+
+
+
+optimizer/util
+- optimizer support routines
+
+
+This contains support routines used by other parts of the optimizer.
+
+
+
+executor
+- executes complex node plans from optimizer
+
+
+This handles select, insert, update, and delete statements.
+The operations required to handle these statement types include
+heap scans, index scans, sorting, joining tables, grouping, aggregates,
+and uniqueness.
+
+
+
+commands
+- commands that do not require the executor
+
+
+These process SQL commands that do not require complex handling.
+It includes vacuum, copy, alter, create table, create type, and
+many others.
+The code is called with the structures generated by the parser.
+Most of the routines do some processing, then call lower-level functions
+in the catalog directory to do the actual work.
+
+
+
+catalog
+- system catalog manipulation
+
+
+This contains functions that manipulate the system tables or catalogs.
+Table, index, procedure, operator, type, and aggregate creation and
+manipulation routines are here.
+These are low-level routines, and are usually called by upper routines
+that pre-format user requests into a predefined format.
+
+
+
+storage
+- manages various storage systems
+
+
+These allow uniform resource access by the backend.
+
+
+
+storage/buffer
+- shared buffer pool manager
+
+
+storage/file
+- file manager
+
+
+storage/ipc
+- semaphores and shared memory
+
+
+storage/large_object
+- large objects
+
+
+storage/lmgr
+- lock manager
+
+
+storage/page
+- page manager
+
+
+storage/smgr
+- storage/disk manager
+
+
+
+
+
+access
+- various data access methods
+
+
+These control the way data is accessed in heap, indexes, and
+transactions.
+
+
+
+access/common
+- common access routines
+
+
+access/gist
+- easy-to-define access method system
+
+
+access/hash
+- hash
+
+
+access/heap
+- heap is use to store data rows
+
+
+access/index
+- used by all index types
+
+
+access/nbtree
+- Lehman and Yao's btree management algorithm
+
+
+access/rtree
+- used for indexing of 2-dimensional data
+
+
+access/transam
+- transaction manager (BEGIN/ABORT/COMMIT)
+
+
+
+
+
+nodes
+- creation/manipulation of nodes and lists
+
+
+PostgreSQL stores information about SQL queries in structures called
+nodes.
+Nodes are generic containers that have a type field and then a
+type-specific data section.
+Nodes are usually placed in Lists.
+A List is container with an elem element,
+and a next field that points to the next List.
+These List structures are chained together in a forward linked list.
+In this way, a chain of Lists can contain an unlimited number of Node
+elements, and each Node can contain any data type.
+These are used extensively in the parser, optimizer, and executor to
+store requests and data.
+
+
+
+utils
+- support routines
+
+
+
+utils/adt
+- built-in data type routines
+
+
+This contains all the PostgreSQL builtin data types.
+
+
+
+utils/cache
+- system/relation/function cache routines
+
+
+PostgreSQL supports arbitrary data types, so no data types are hard-coded
+into the core backend routines.
+When the backend needs to find out about a type, is does a lookup of a
+system table.
+Because these system tables are referred to often, a cache is maintained
+that speeds lookups.
+There is a system relation cache, a function/operator cache, and a relation
+information cache.
+This last cache maintains information about all recently-accessed
+tables, not just system ones.
+
+
+
+utils/error
+- error reporting routines
+
+
+Reports backend errors to the front end.
+
+
+
+utils/fmgr
+- function manager
+
+
+This handles the calling of dynamically-loaded functions, and the calling
+of functions defined in the system tables.
+
+
+
+utils/hash
+- hash routines for internal algorithms
+
+
+These hash routines are used by the cache and memory-manager routines to
+do quick lookups of dynamic data storage structures maintained by the
+backend.
+
+
+
+utils/init
+- various initialization stuff
+
+
+
+utils/misc
+- miscellaneous stuff
+
+
+
+utils/mmgr
+- memory manager(process-local memory)
+
+
+When PostgreSQL allocates memory, it does so in an explicit context.
+Contexts can be statement-specific, transaction-specific, or
+persistent/global.
+By doing this, the backend can easily free memory once a statement or
+transaction completes.
+
+
+
+utils/sort
+- sort routines for internal algorithms
+
+
+When statement output must be sorted as part of a backend operation,
+this code sorts the tuples, either in memory or using disk files.
+
+
+
+utils/time
+- transaction time qualification routines
+
+
+These routines do checking of tuple internal columns to determine if the
+current row is still valid, or is part of a non-committed transaction or
+superseded by a new row.
+
+
+
+include
+- include files
+
+
+There are include directories for each subsystem.
+
+
+
+lib
+- support library
+
+
+This houses several generic routines.
+
+
+
+regex
+- regular expression library
+
+
+This is used for regular expression handling in the backend, i.e. '~'.
+
+
+
+rewrite
+- rules system
+
+
+This does processing for the rules system.
+
+
+
+tioga
+- unused (array handling?)
+
+
+
+Maintainer: Bruce Momjianmaillist@candle.pha.pa.us)
+Last updated: Mon Oct 27 11:01:08 EST 1997
+
diff --git a/src/tools/backend/flow.fig b/src/tools/backend/flow.fig
new file mode 100644
index 00000000000..265fb28e089
--- /dev/null
+++ b/src/tools/backend/flow.fig
@@ -0,0 +1,140 @@
+#FIG 3.1
+Landscape
+Center
+Inches
+1200 2
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 1200 6900 600 4500 600 4500 1200 6900 1200
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 1200 5700 1800
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 2400 6900 1800 4500 1800 4500 2400 6900 2400
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 3600 6900 3000 4500 3000 4500 3600 6900 3600
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 2400 5700 3000
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 10800 3600 10800 3000 8400 3000 8400 3600 10800 3600
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 2400 9600 3000
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 5100 6900 4500 4500 4500 4500 5100 6900 5100
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 6300 6900 5700 4500 5700 4500 6300 6900 6300
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 5100 5700 5700
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 7500 6900 6900 4500 6900 4500 7500 6900 7500
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 6300 5700 6900
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 8700 6900 8100 4500 8100 4500 8700 6900 8700
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 7500 5700 8100
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 8700 5700 9300
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 10800 6300 10800 5700 8400 5700 8400 6300 10800 6300
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 6900 6000 8400 6000
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 3
+ 0 0 1.00 60.00 120.00
+ 4500 9600 3900 9600 3900 6600
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 4
+ 0 0 1.00 60.00 120.00
+ 10800 6000 11400 6000 11400 4200 5700 4200
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
+ 2700 8100
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
+ 8475 2175
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
+ 8475 2175
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 3900 6600 3900 4200
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 3900 4200 5700 4200
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 4200 5700 4500
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 2700 9600 2700 9000 300 9000 300 9600 2700 9600
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 2700 9300 3300 9300
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 2700 8700 2700 8100 300 8100 300 8700 2700 8700
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 2700 8400 3300 8400
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 2700 7800 2700 7200 300 7200 300 7800 2700 7800
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 3300 7500 2700 7500
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 2700 6900 2700 6300 300 6300 300 6900 2700 6900
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 3300 6600 2700 6600
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 2700 6000 2700 5400 300 5400 300 6000 2700 6000
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 2700 5700 3300 5700
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 6900 9900 6900 9300 4500 9300 4500 9900 6900 9900
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 8 0 0 5
+ 10800 1200 10800 600 8400 600 8400 1200 10800 1200
+2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
+ 10800 2400 10800 1800 8400 1800 8400 2400 10800 2400
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 8400 2100 7725 2100
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 1 2
+ 0 0 1.00 60.00 120.00
+ 0 0 1.00 60.00 120.00
+ 8325 2175 7725 2550
+2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
+ 0 0 1.00 60.00 120.00
+ 5700 3600 5700 4200
+4 1 -1 0 0 28 18 0.0000 4 195 630 5670 990 Main\001
+4 1 -1 0 0 28 18 0.0000 4 195 1470 5685 2190 Postmaster\001
+4 1 -1 0 0 28 18 0.0000 4 240 1110 9585 3375 Postgres\001
+4 1 -1 0 0 28 18 0.0000 4 240 1110 5700 3390 Postgres\001
+4 1 -1 0 0 28 18 0.0000 4 240 915 9600 5970 Simple\001
+4 1 -1 0 0 28 18 0.0000 4 195 1980 5685 7455 Generate Paths\001
+4 1 -1 0 0 28 18 0.0000 4 195 1275 5715 7170 Rewrite &\001
+4 1 -1 0 0 28 18 0.0000 4 255 1500 5715 6090 Traffic Cop\001
+4 1 -1 0 0 28 18 0.0000 4 195 825 5685 4875 Parser\001
+4 1 -1 0 0 28 18 0.0000 4 195 1485 9600 6255 Commands\001
+4 1 -1 0 0 28 18 0.0000 4 195 1830 5715 8670 Generate Plan\001
+4 1 -1 0 0 28 18 0.0000 4 195 1890 5700 8400 Choose Path &\001
+4 1 -1 0 0 28 18 0.0000 4 240 900 7605 5925 simple\001
+4 1 -1 0 0 28 18 0.0000 4 240 1125 5715 6660 complex\001
+4 0 -1 0 0 0 24 0.0000 4 330 1290 600 1470 Program\001
+4 0 -1 0 0 0 24 0.0000 4 255 735 600 1890 Flow\001
+4 0 -1 0 0 0 24 0.0000 4 330 1800 600 1050 PostgreSQL\001
+4 0 -1 0 0 0 18 0.0000 4 255 1095 9000 975 Bootstrap\001
+4 1 -1 0 0 28 18 0.0000 4 240 2325 1515 9390 Storage Managers\001
+4 0 -1 0 0 0 18 0.0000 4 225 1425 750 8475 Nodes / Lists\001
+4 1 -1 0 0 28 18 0.0000 4 195 1050 1485 7590 Utilities\001
+4 1 -1 0 0 28 18 0.0000 4 195 2100 1485 5805 Access Methods\001
+4 1 -1 0 0 28 18 0.0000 4 195 1140 5685 9720 Executor\001
+4 0 -1 0 0 0 18 0.0000 4 255 645 9225 2175 Libpq\001
+4 0 -1 0 0 0 18 0.0000 4 255 840 1050 6675 Catalog\001
diff --git a/src/tools/backend/flow.gif b/src/tools/backend/flow.gif
new file mode 100644
index 00000000000..1076af06f42
Binary files /dev/null and b/src/tools/backend/flow.gif differ
diff --git a/src/tools/backend/index.html b/src/tools/backend/index.html
new file mode 100644
index 00000000000..6b5362dff8c
--- /dev/null
+++ b/src/tools/backend/index.html
@@ -0,0 +1,42 @@
+
+
+PostgreSQL Backend Flowchart
+
+
+
+PostgreSQL Backend Flowchart
+
+
+by Bruce Momjian
+
+
+Click on an item to see more detail.
+
+
+
+
+
+
+
+Maintainer: Bruce Momjianmaillist@candle.pha.pa.us)
+Last updated: Mon Oct 27 11:01:08 EST 1997
+
--
cgit v1.2.3