Skip to content

Commit 224a62c

Browse files
committed
Update.
1 parent 7f61f8a commit 224a62c

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

src/tools/backend/index.html

+47-47
Original file line numberDiff line numberDiff line change
@@ -43,37 +43,35 @@ <H2 ALIGN=CENTER>
4343

4444
<HR>
4545
<P>
46-
A query comes to the backend via data packets arriving through TCP/IP
47-
or Unix Domain sockets. It is loaded into a string, and passed to
48-
the
46+
47+
A query comes to the backend via data packets arriving through TCP/IP or
48+
Unix Domain sockets. It is loaded into a string, and passed to the
4949
<A HREF="../../backend/parser">parser,</A> where the lexical scanner,
50-
<A HREF="../../backend/parser/scan.l">scan.l,</A>
51-
breaks the query up into tokens(words). The parser
52-
uses
53-
<A HREF="../../backend/parser/gram.y">gram.y</A> and the tokens to
54-
identify the query type, and load the proper query-specific structure,
55-
like <A HREF="../../include/nodes/parsenodes.h">CreateStmt</A> or <A
56-
HREF="../../include/nodes/parsenodes.h">SelectStmt.</A>
57-
<P>
50+
<A HREF="../../backend/parser/scan.l">scan.l,</A> breaks the query up
51+
into tokens(words). The parser uses <A
52+
HREF="../../backend/parser/gram.y">gram.y</A> and the tokens to identify
53+
the query type, and load the proper query-specific structure, like <A
54+
HREF="../../include/nodes/parsenodes.h">CreateStmt</A> or <A
55+
HREF="../../include/nodes/parsenodes.h">SelectStmt.</A><P>
56+
5857

5958
The query is then identified as a <I>Utility</I> query or a more complex
6059
query. A <I>Utility</I> query is processed by a query-specific function
6160
in <A HREF="../../backend/commands"> commands.</A> A complex query, like
62-
<I>SELECT, UPDATE,</I> and
63-
<I>DELETE</I> requires much more handling.
64-
<P>
61+
<I>SELECT, UPDATE,</I> and <I>DELETE</I> requires much more handling.<P>
62+
6563

6664
The parser takes a complex query, and creates a
6765
<A HREF="../../include/nodes/parsenodes.h">Query</A> structure that
6866
contains all the elements used by complex queries. Query.qual holds the
69-
<I>WHERE</I> clause qualification, which is filled in by
70-
<A HREF="../../backend/parser/parse_clause.c">transformWhereClause().</A>
67+
<I>WHERE</I> clause qualification, which is filled in by <A
68+
HREF="../../backend/parser/parse_clause.c">transformWhereClause().</A>
7169
Each table referenced in the query is represented by a <A
7270
HREF="../../include/nodes/parsenodes.h"> RangeTableEntry,</A> and they
73-
are linked together to form the <I>range table</I> of the query, which is
74-
generated by <A HREF="../../backend/parser/parse_clause.c">
75-
makeRangeTable().</A> Query.rtable holds the query's range table.
76-
<P>
71+
are linked together to form the <I>range table</I> of the query, which
72+
is generated by <A HREF="../../backend/parser/parse_clause.c">
73+
makeRangeTable().</A> Query.rtable holds the query's range table.<P>
74+
7775

7876
Certain queries, like <I>SELECT,</I> return columns of data. Other
7977
queries, like <I>INSERT</I> and <I>UPDATE,</I> specify the columns
@@ -82,64 +80,65 @@ <H2 ALIGN=CENTER>
8280
placed in <A HREF="../../include/nodes/parsenodes.h">target list
8381
entries,</I> and linked together to make up the <I>target list</I> of
8482
the query. The target list is stored in Query.targetList, which is
85-
generated by
86-
<A HREF="../../backend/parser/parse_target.c">transformTargetList().</A>
87-
<P>
83+
generated by <A
84+
HREF="../../backend/parser/parse_target.c">transformTargetList().</A><P>
85+
8886

8987
Other query elements, like aggregates(<I>SUM()</I>), <I>GROUP BY,</I>
90-
and <I>ORDER BY</I> are also stored in their own Query fields.
91-
<P>
88+
and <I>ORDER BY</I> are also stored in their own Query fields.<P>
89+
9290

9391
The next step is for the Query to be modified by any <I>VIEWS</I> or
9492
<I>RULES</I> that may apply to the query. This is performed by the <A
95-
HREF="../../backend/rewrite">rewrite</A> system.
96-
<P>
93+
HREF="../../backend/rewrite">rewrite</A> system.<P>
94+
9795

9896
The <A HREF="../../backend/optimizer">optimizer</A> takes the Query
9997
structure and generates an optimal <A
10098
HREF="../..//include/nodes/plannodes.h">Plan,</A> which contains the
10199
operations to be performed to execute the query. The <A
102100
HREF="../../backend/optimizer/path">path</A> module determines the best
103101
table join order and join type of each table in the RangeTable, using
104-
Query.qual(<I>WHERE</I> clause) to consider optimal index usage.
105-
<P>
102+
Query.qual(<I>WHERE</I> clause) to consider optimal index usage.<P>
106103

107104

108105
The Plan is then passed to the <A
109106
HREF="../../backend/executor">executor</A> for execution, and the result
110107
returned to the client. The Plan actually as set of nodes, arranged in
111108
a tree structure with a top-level node, and various sub-nodes as
112-
children.
113-
<P>
109+
children.<P>
114110

115-
There are many other modules that support this basic functionality.
116-
They can be accessed by clicking on the flowchart.
117-
<P>
118111

119-
<HR>
120-
<P>
112+
There are many other modules that support this basic functionality. They
113+
can be accessed by clicking on the flowchart.<P>
114+
115+
116+
<HR><P>
117+
121118

122119
Another area of interest is the shared memory area, which contains data
123120
accessable to all backends. It has table recently used data/index
124121
blocks, locks, backend information, and lookup tables for these
125122
structures:
123+
126124
<UL>
127125
<LI>ShmemIndex - lookup shared memory addresses using structure names
128126
<LI><A HREF="../../include/storage/buf_internals.h">Buffer
129127
Descriptor</A> - control header for buffer cache block
130128
<LI><A HREF="../../include/storage/buf_internals.h">Buffer Block</A> -
131129
data/index buffer cache block
132-
<LI>Shared Buffer Lookup Table - lookup of buffer cache block addresses using
133-
table name and block number(<A HREF="../../include/storage/buf_internals.h">
134-
BufferTag</A>)
135-
<LI>MultiLevelLockTable (ctl) - control structure for
136-
each locking method. Currently, only multi-level locking is used(<A
130+
<LI>Shared Buffer Lookup Table - lookup of buffer cache block addresses
131+
using table name and block number(<A
132+
HREF="../../include/storage/buf_internals.h"> BufferTag</A>)
133+
<LI>MultiLevelLockTable (ctl) - control structure for each locking
134+
method. Currently, only multi-level locking is used(<A
137135
HREF="../../include/storage/lock.h">LOCKMETHODCTL</A>).
138136
<LI>MultiLevelLockTable (lock hash) - the <A
139137
HREF="../../include/storage/lock.h">LOCK</A> structure, looked up using
140138
relation, database object ids(<A
141-
HREF="../../include/storage/lock.h">LOCKTAG)</A>. The lock table structure contains the
142-
lock modes(read/write or shared/exclusive) and circular linked list of backends (<A
139+
HREF="../../include/storage/lock.h">LOCKTAG)</A>. The lock table
140+
structure contains the lock modes(read/write or shared/exclusive) and
141+
circular linked list of backends (<A
143142
HREF="../../include/storage/proc.h">PROC</A> structure pointers) waiting
144143
on the lock.
145144
<LI>MultiLevelLockTable (xid hash) - lookup of LOCK structure address
@@ -152,11 +151,12 @@ <H2 ALIGN=CENTER>
152151
<LI><A HREF="../../include/storage/proc.h">Proc Header</A> - information
153152
about each backend, including locks held/waiting, indexed by process id
154153
</UL>
154+
155155
Each data structure is created by calling <A
156-
HREF="../../backend/storage/ipc/shmem.c">ShmemInitStruct(),</A> and
157-
the lookups are created by
158-
<A HREF="../../backend/storage/ipc/shmem.c">ShmemInitHash().</A>
159-
<P>
156+
HREF="../../backend/storage/ipc/shmem.c">ShmemInitStruct(),</A> and the
157+
lookups are created by <A
158+
HREF="../../backend/storage/ipc/shmem.c">ShmemInitHash().</A><P>
159+
160160

161161
<HR SIZE="2" NOSHADE>
162162
<SMALL>

0 commit comments

Comments
 (0)