update
authorBruce Momjian
Tue, 30 Jun 1998 04:35:34 +0000 (04:35 +0000)
committerBruce Momjian
Tue, 30 Jun 1998 04:35:34 +0000 (04:35 +0000)
src/tools/backend/index.html

index 3f032e081c359fe4f0a242ee501400e20236a366..b94f39be66283efd6494f1f1964152f8662feecd 100644 (file)
@@ -1,31 +1,31 @@
 
 
-<span class="marked">PostgreSQL Backend Flowchart</span>
+<span class="marked">How PostgreSQL Processes a Query</span>
 
 
 
-PostgreSQL Backend Flowchart
+How PostgreSQL Processes a Query
 
 
 by Bruce Momjian
 
 

-A query come into the backend via data packets coming in through TCP/IP
-and Unix Domain sockets.   It is loaded into a string, and passed to
+A query comes to the backend via data packets arriving through TCP/IP
+or Unix Domain sockets.   It is loaded into a string, and passed to
 the
 parser, where the lexical scanner,
 scan.l,
 breaks the query up into tokens(words).  The parser
 uses
 gram.y and the tokens to
-identify the query type, and load the proper query-specific
-structure, like
-CreateStmt or SelectStmt.
+identify the query type, and load the proper query-specific structure,
+like CreateStmt or 
+HREF="../../include/nodes/parsenodes.h">SelectStmt.
 

-The query is then identified as a Utility function or a more
-complex query.  A Utility query is processed by a
-query-specific function in 
-commands. A complex query, like SELECT, UPDATE, and
+The query is then identified as a Utility query or a more complex
+query.  A Utility query is processed by a query-specific function
+in  commands. A complex query, like
+SELECT, UPDATE, and
 DELETE requires much more handling.
 

 The parser takes a complex query, and creates a
@@ -37,7 +37,7 @@ Each table referenced in the query is represented by a 
 HREF="../../include/nodes/parsenodes.h"> RangeTableEntry, and they
 are linked together to form the range table of the query, which is
 generated by 
-makeRangeTable().  Query.rtable holds the queries range table.
+makeRangeTable().  Query.rtable holds the query's range table.
 

 Certain queries, like SELECT, return columns of data.  Other
 queries, like INSERT and UPDATE, specify the columns
@@ -48,7 +48,7 @@ target list is stored in Query.targetList, which is generated by
 transformTargetList().
 

 Other query elements, like aggregates(SUM()), GROUP BY,
-ORDER BY are also stored in their own Query fields.
+and ORDER BY are also stored in their own Query fields.
 

 The next step is for the Query to be modified by any VIEWS or
 RULES that may apply to the query.  This is performed by the 
@@ -69,21 +69,22 @@ returned to the client.
 There are many other modules that support this basic functionality.
 They can be accessed by clicking on the flowchart.
 

-Another area of interest is the shared memory area, containing table
-data/index blocks, locks, backend information, and lookup tables for
-these structures:
+Another area of interest is the shared memory area, which contains data
+accessable to all backends.  It has table recently used data/index
+blocks, locks, backend information, and lookup tables for these
+structures:
 
     
 
  • ShmemIndex - lookup shared memory addresses using structure names
  •  
  • Buffer
  • -Descriptors - control header for buffer cache block
    -
  • Buffer Blocks -
  • +Descriptor - control header for buffer cache block
    +
  • Buffer Block -
  •  data/index buffer cache block
    -
  • Shared Buf Lookup Table - lookup of buffer cache block address using
  • +
  • Shared Buffer Lookup Table - lookup of buffer cache block addresses using
  •  table name and block number(
     BufferTag)
    -
  • MultiLevelLockTable (ctl) - 
  • -HREF="../../include/storage/lock.h">LOCKCTL control structure for
    -each locking method.  Currently, only multi-level locking is used.
    +
  • MultiLevelLockTable (ctl) - control structure for
  • +each locking method.  Currently, only multi-level locking is used(
    +HREF="../../include/storage/lock.h">LOCKMETHODCTL).
     
  • MultiLevelLockTable (lock hash) - the 
     HREF="../../include/storage/lock.h">LOCK structure, looked up using
     relation, database object ids(
    @@ -105,7 +106,9 @@ Each data structure is created by calling 
     HREF="../../backend/storage/ipc/shmem.c">ShmemInitStruct(), and
     the lookups are created by
     ShmemInitHash().
    +

     
    +

     
     
     Click on an item to see more detail or