Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
34d59572
Commit
34d59572
authored
Jun 30, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2584029e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
src/tools/backend/index.html
src/tools/backend/index.html
+25
-22
No files found.
src/tools/backend/index.html
View file @
34d59572
<HTML>
<HEAD>
<TITLE>
PostgreSQL Backend Flowchart
</TITLE>
<TITLE>
How PostgreSQL Processes a Query
</TITLE>
</HEAD>
<BODY
BGCOLOR=
"#FFFFFF"
TEXT=
"#000000"
LINK=
"#FF0000"
VLINK=
"#A00000"
ALINK=
"#0000FF"
>
<H1
ALIGN=
CENTER
>
PostgreSQL Backend Flowchart
How PostgreSQL Processes a Query
</H1>
<H2
ALIGN=
CENTER
>
by Bruce Momjian
</H2>
<P>
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 come
s to the backend via data packets arriving
through TCP/IP
or
Unix Domain sockets. It is loaded into a string, and passed to
the
<A
HREF=
"../../backend/parser"
>
parser,
</A>
where the lexical scanner,
<A
HREF=
"../../backend/parser/scan.l"
>
scan.l,
</A>
breaks the query up into tokens(words). The parser
uses
<A
HREF=
"../../backend/parser/gram.y"
>
gram.y
</A>
and the tokens to
identify the query type, and load the proper query-specific
structure, like
<A
HREF=
"../../include/nodes/parsenodes.h"
>
CreateStmt or
SelectStmt.
</A>
identify the query type, and load the proper query-specific
structure,
like
<A
HREF=
"../../include/nodes/parsenodes.h"
>
CreateStmt
</A>
or
<A
HREF=
"../../include/nodes/parsenodes.h"
>
SelectStmt.
</A>
<P>
The query is then identified as a
<I>
Utility
</I>
function or a more
complex query. A
<I>
Utility
</I>
query is processed by a
query-specific function in
<A
HREF=
"../../backend/commands"
>
commands.
</A>
A complex query, like
<CODE>
SELECT, UPDATE,
</CODE>
and
The query is then identified as a
<I>
Utility
</I>
query or a more complex
query. A
<I>
Utility
</I>
query is processed by a query-specific function
in
<A
HREF=
"../../backend/commands"
>
commands.
</A>
A complex query, like
<CODE>
SELECT, UPDATE,
</CODE>
and
<CODE>
DELETE
</CODE>
requires much more handling.
<P>
The parser takes a complex query, and creates a
...
...
@@ -37,7 +37,7 @@ Each table referenced in the query is represented by a <A
HREF=
"../../include/nodes/parsenodes.h"
>
RangeTableEntry,
</A>
and they
are linked together to form the
<I>
range table
</I>
of the query, which is
generated by
<A
HREF=
"../../backend/parser/parse_clause.c"
>
makeRangeTable().
</A>
Query.rtable holds the quer
ie
s range table.
makeRangeTable().
</A>
Query.rtable holds the quer
y'
s range table.
<P>
Certain queries, like
<CODE>
SELECT,
</CODE>
return columns of data. Other
queries, like
<CODE>
INSERT
</CODE>
and
<CODE>
UPDATE,
</CODE>
specify the columns
...
...
@@ -48,7 +48,7 @@ target list is stored in Query.targetList, which is generated by
<A
HREF=
"../../backend/parser/parse_target.c"
>
transformTargetList().
</A>
<P>
Other query elements, like aggregates(
<CODE>
SUM()
</CODE>
),
<CODE>
GROUP BY,
</CODE>
<CODE>
ORDER BY
</CODE>
are also stored in their own Query fields.
and
<CODE>
ORDER BY
</CODE>
are also stored in their own Query fields.
<P>
The next step is for the Query to be modified by any
<CODE>
VIEWS
</CODE>
or
<CODE>
RULES
</CODE>
that may apply to the query. This is performed by the
<A
...
...
@@ -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.
<P>
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:
<UL>
<LI>
ShmemIndex - lookup shared memory addresses using structure names
<LI><A
HREF=
"../../include/storage/buf_internals.h"
>
Buffer
Descriptor
s
</A>
- control header for buffer cache block
<LI><A
HREF=
"../../include/storage/buf_internals.h"
>
Buffer Block
s
</A>
-
Descriptor
</A>
- control header for buffer cache block
<LI><A
HREF=
"../../include/storage/buf_internals.h"
>
Buffer Block
</A>
-
data/index buffer cache block
<LI>
Shared Buf
Lookup Table - lookup of buffer cache block addres
s using
<LI>
Shared Buf
fer Lookup Table - lookup of buffer cache block addresse
s using
table name and block number(
<A
HREF=
"../../include/storage/buf_internals.h"
>
BufferTag
</A>
)
<LI>
MultiLevelLockTable (ctl) -
<A
HREF=
"../../include/storage/lock.h"
>
LOCKCTL
</A>
control structure for
each locking method. Currently, only multi-level locking is used
.
<LI>
MultiLevelLockTable (ctl) -
control structure for
each locking method. Currently, only multi-level locking is used(
<A
HREF=
"../../include/storage/lock.h"
>
LOCKMETHODCTL
</A>
)
.
<LI>
MultiLevelLockTable (lock hash) - the
<A
HREF=
"../../include/storage/lock.h"
>
LOCK
</A>
structure, looked up using
relation, database object ids(
<A
...
...
@@ -105,7 +106,9 @@ Each data structure is created by calling <A
HREF=
"../../backend/storage/ipc/shmem.c"
>
ShmemInitStruct(),
</A>
and
the lookups are created by
<A
HREF=
"../../backend/storage/ipc/shmem.c"
>
ShmemInitHash().
</A>
<P>
<HR>
<P>
<CENTER>
<EM><BIG>
Click on an item to see more detail or
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment