diff --git a/src/tools/backend/README b/src/tools/backend/README
new file mode 100644
index 0000000000..601c66cc4b
--- /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_DIRS.html b/src/tools/backend/backend_dirs.html
similarity index 56%
rename from src/tools/BACKEND_DIRS.html
rename to src/tools/backend/backend_dirs.html
index 0d9a1bc7d9..3ef940f0ca 100644
--- a/src/tools/BACKEND_DIRS.html
+++ b/src/tools/backend/backend_dirs.html
@@ -10,7 +10,9 @@ PostgreSQL Backend Directories
by Bruce Momjian
-bootstrap - creates initial template database via initdb
+
+bootstrap
+- creates initial template database via initdb
Because PostgreSQL requires access to system tables for almost every
@@ -22,14 +24,18 @@ 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
+
+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
+
+postmaster
+- controls postgres server startup/termination
This creates shared memory, and then goes into a loop waiting for
@@ -38,13 +44,17 @@ When a connection request arrives, a postgres backend is started,
and the connection is passed to it.
-libpq - backend libpq library routines
+
+libpq
+- backend libpq library routines
This handles communication to the client processes.
-tcop - traffic cop, dispatches request to proper module
+
+tcop
+- traffic cop, dispatches request to proper module
This contains the postgres backend main handler, as well as the
@@ -52,7 +62,9 @@ code that makes calls to the parser, optimizer, executor, and
/commands functions.
-parser - converts SQL query to query tree
+
+parser
+- converts SQL query to query tree
This converts SQL queries coming from libpq into command-specific
@@ -67,14 +79,18 @@ The command-specific structures are then broken apart, checked, and passed to
Nodes to be handled by the optimizer and executor.
-optimizer - creates path and plan
+
+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
+
+optimizer/path
+- creates path from parser output
This takes the parser query output, and generates all possible methods of
@@ -84,7 +100,9 @@ and optimizer table statistics to evaluate each possible execution
method, and assigns a cost to each.
optimizer/path evaluates all possible ways to join the requested tables.
@@ -97,26 +115,34 @@ 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
+
+optimizer/prep
+- handle special plan cases
This does special plan processing.
-optimizer/util - optimizer support routines
+
+optimizer/util
+- optimizer support routines
This contains support routines used by other parts of the optimizer.
-executor - executes complex node plans from optimizer
+
+executor
+- executes complex node plans from optimizer
This handles select, insert, update, and delete statements.
@@ -125,7 +151,9 @@ heap scans, index scans, sorting, joining tables, grouping, aggregates,
and uniqueness.
-commands - commands that do not require the executor
+
+commands
+- commands that do not require the executor
These process SQL commands that do not require complex handling.
@@ -136,7 +164,9 @@ 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
+
+catalog
+- system catalog manipulation
This contains functions that manipulate the system tables or catalogs.
@@ -146,56 +176,92 @@ 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
+
+storage
+- manages various storage systems
These allow uniform resource access by the backend.
-storage/buffer - shared buffer pool manager
+
+storage/buffer
+- shared buffer pool manager
-storage/file - file manager
+
+storage/file
+- file manager
-storage/ipc - semaphores and shared memory
+
+storage/ipc
+- semaphores and shared memory
-storage/large_object - large objects
+
+storage/large_object
+- large objects
-storage/lmgr - lock manager
+
+storage/lmgr
+- lock manager
-storage/page - page manager
+
+storage/page
+- page manager
-storage/smgr - storage/disk manager
+
+storage/smgr
+- storage/disk manager
-access - various data access methods
+
+access
+- various data access methods
These control the way data is accessed in heap, indexes, and
transactions.
-access/common - common access routines
+
+access/common
+- common access routines
-access/gist - easy-to-define access method system
+
+access/gist
+- easy-to-define access method system
-access/hash - hash
+
+access/hash
+- hash
-access/heap - heap is use to store data rows
+
+access/heap
+- heap is use to store data rows
-access/index - used by all index types
+
+access/index
+- used by all index types
-access/nbtree - Lehman and Yao's btree management algorithm
+
+access/nbtree
+- Lehman and Yao's btree management algorithm
-access/rtree - used for indexing of 2-dimensional data
+
+access/rtree
+- used for indexing of 2-dimensional data
-access/transam - transaction manager (BEGIN/ABORT/COMMIT)
+
+access/transam
+- transaction manager (BEGIN/ABORT/COMMIT)
-nodes - creation/manipulation of nodes and lists
+
+nodes
+- creation/manipulation of nodes and lists
PostgreSQL stores information about SQL queries in structures called
@@ -212,16 +278,22 @@ These are used extensively in the parser, optimizer, and executor to
store requests and data.
-utils - support routines
+
+utils
+- support routines
-utils/adt - built-in data type routines
+
+utils/adt
+- built-in data type routines
This contains all the PostgreSQL builtin data types.
-utils/cache - system/relation/function cache routines
+
+utils/cache
+- system/relation/function cache routines
PostgreSQL supports arbitrary data types, so no data types are hard-coded
@@ -236,20 +308,26 @@ This last cache maintains information about all recently-accessed
tables, not just system ones.
-utils/error - error reporting routines
+
+utils/error
+- error reporting routines
Reports backend errors to the front end.
-utils/fmgr - function manager
+
+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
+
+utils/hash
+- hash routines for internal algorithms
These hash routines are used by the cache and memory-manager routines to
@@ -257,13 +335,19 @@ do quick lookups of dynamic data storage structures maintained by the
backend.
-utils/init - various initialization stuff
+
+utils/init
+- various initialization stuff
-utils/misc - miscellaneous stuff
+
+utils/misc
+- miscellaneous stuff
-utils/mmgr - memory manager(process-local memory)
+
+utils/mmgr
+- memory manager(process-local memory)
When PostgreSQL allocates memory, it does so in an explicit context.
@@ -273,14 +357,18 @@ By doing this, the backend can easily free memory once a statement or
transaction completes.
-utils/sort - sort routines for internal algorithms
+
+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
+
+utils/time
+- transaction time qualification routines
These routines do checking of tuple internal columns to determine if the
@@ -288,31 +376,41 @@ current row is still valid, or is part of a non-committed transaction or
superseded by a new row.
-include - include files
+
+include
+- include files
There are include directories for each subsystem.
-lib - support library
+
+lib
+- support library
This houses several generic routines.
-regex - regular expression library
+
+regex
+- regular expression library
This is used for regular expression handling in the backend, i.e. '~'.
-rewrite - rules system
+
+rewrite
+- rules system
This does processing for the rules system.
-tioga - unused (array handling?)
+
+tioga
+- unused (array handling?)
diff --git a/src/tools/flow.fig b/src/tools/backend/flow.fig
similarity index 65%
rename from src/tools/flow.fig
rename to src/tools/backend/flow.fig
index f609590fe7..265fb28e08 100644
--- a/src/tools/flow.fig
+++ b/src/tools/backend/flow.fig
@@ -20,21 +20,8 @@ Inches
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
- 2700 5100 2700 4500 300 4500 300 5100 2700 5100
-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 1500 4500
-2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
- 2700 6300 2700 5700 300 5700 300 6300 2700 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
- 1500 5100 1500 5700
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 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 6
- 0 0 1.00 60.00 120.00
- 1500 6300 1500 6600 3900 6600 3900 4200 5700 4200 5700 4500
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
@@ -50,58 +37,91 @@ Inches
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 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
- 6900 9600 6900 9000 4500 9000 4500 9600 6900 9600
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 9000
+ 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 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
- 2700 7500 2700 6900 300 6900 300 7500 2700 7500
-2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
- 2700 8400 2700 7800 300 7800 300 8400 2700 8400
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 9300 3900 9300 3900 6600
+ 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 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5
- 2700 9300 2700 8700 300 8700 300 9300 2700 9300
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 7200 3300 7200
+ 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 8100 3300 8100
+ 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
- 2700 9000 3300 9000
+ 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 195 1710 1500 4905 Initialization\001
-4 1 -1 0 0 28 18 0.0000 4 195 1215 1470 5940 Attach to\001
-4 1 -1 0 0 28 18 0.0000 4 195 2340 1485 6270 Shared Resources\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 1140 5685 9420 Executor\001
-4 1 -1 0 0 28 18 0.0000 4 195 2100 1485 7305 Access Methods\001
-4 1 -1 0 0 28 18 0.0000 4 195 1050 1485 9090 Utilities\001
-4 1 -1 0 0 28 18 0.0000 4 240 2325 1515 8190 Storage Managers\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
@@ -110,3 +130,11 @@ Inches
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 0000000000..1076af06f4
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 0000000000..6b5362dff8
--- /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
+
diff --git a/src/tools/flow.gif b/src/tools/flow.gif
deleted file mode 100644
index 5d697a39f0..0000000000
Binary files a/src/tools/flow.gif and /dev/null differ