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
Show 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>
<HTML>
<HEAD>
<HEAD>
<TITLE>
PostgreSQL Backend Flowchart
</TITLE>
<TITLE>
How PostgreSQL Processes a Query
</TITLE>
</HEAD>
</HEAD>
<BODY
BGCOLOR=
"#FFFFFF"
TEXT=
"#000000"
LINK=
"#FF0000"
VLINK=
"#A00000"
ALINK=
"#0000FF"
>
<BODY
BGCOLOR=
"#FFFFFF"
TEXT=
"#000000"
LINK=
"#FF0000"
VLINK=
"#A00000"
ALINK=
"#0000FF"
>
<H1
ALIGN=
CENTER
>
<H1
ALIGN=
CENTER
>
PostgreSQL Backend Flowchart
How PostgreSQL Processes a Query
</H1>
</H1>
<H2
ALIGN=
CENTER
>
<H2
ALIGN=
CENTER
>
by Bruce Momjian
by Bruce Momjian
</H2>
</H2>
<P>
<P>
A query come
into the backend via data packets coming in
through TCP/IP
A query come
s to the backend via data packets arriving
through TCP/IP
and
Unix Domain sockets. It is loaded into a string, and passed to
or
Unix Domain sockets. It is loaded into a string, and passed to
the
the
<A
HREF=
"../../backend/parser"
>
parser,
</A>
where the lexical scanner,
<A
HREF=
"../../backend/parser"
>
parser,
</A>
where the lexical scanner,
<A
HREF=
"../../backend/parser/scan.l"
>
scan.l,
</A>
<A
HREF=
"../../backend/parser/scan.l"
>
scan.l,
</A>
breaks the query up into tokens(words). The parser
breaks the query up into tokens(words). The parser
uses
uses
<A
HREF=
"../../backend/parser/gram.y"
>
gram.y
</A>
and the tokens to
<A
HREF=
"../../backend/parser/gram.y"
>
gram.y
</A>
and the tokens to
identify the query type, and load the proper query-specific
identify the query type, and load the proper query-specific
structure,
structure, like
like
<A
HREF=
"../../include/nodes/parsenodes.h"
>
CreateStmt
</A>
or
<A
<A
HREF=
"../../include/nodes/parsenodes.h"
>
CreateStmt or
SelectStmt.
</A>
HREF=
"../../include/nodes/parsenodes.h"
>
SelectStmt.
</A>
<P>
<P>
The query is then identified as a
<I>
Utility
</I>
function or a more
The query is then identified as a
<I>
Utility
</I>
query or a more complex
complex query. A
<I>
Utility
</I>
query is processed by a
query. A
<I>
Utility
</I>
query is processed by a query-specific function
query-specific function in
<A
HREF=
"../../backend/commands"
>
in
<A
HREF=
"../../backend/commands"
>
commands.
</A>
A complex query, like
commands.
</A>
A complex query, like
<CODE>
SELECT, UPDATE,
</CODE>
and
<CODE>
SELECT, UPDATE,
</CODE>
and
<CODE>
DELETE
</CODE>
requires much more handling.
<CODE>
DELETE
</CODE>
requires much more handling.
<P>
<P>
The parser takes a complex query, and creates a
The parser takes a complex query, and creates a
...
@@ -37,7 +37,7 @@ Each table referenced in the query is represented by a <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
HREF=
"../../include/nodes/parsenodes.h"
>
RangeTableEntry,
</A>
and they
are linked together to form the
<I>
range table
</I>
of the query, which is
are linked together to form the
<I>
range table
</I>
of the query, which is
generated by
<A
HREF=
"../../backend/parser/parse_clause.c"
>
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>
<P>
Certain queries, like
<CODE>
SELECT,
</CODE>
return columns of data. Other
Certain queries, like
<CODE>
SELECT,
</CODE>
return columns of data. Other
queries, like
<CODE>
INSERT
</CODE>
and
<CODE>
UPDATE,
</CODE>
specify the columns
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
...
@@ -48,7 +48,7 @@ target list is stored in Query.targetList, which is generated by
<A
HREF=
"../../backend/parser/parse_target.c"
>
transformTargetList().
</A>
<A
HREF=
"../../backend/parser/parse_target.c"
>
transformTargetList().
</A>
<P>
<P>
Other query elements, like aggregates(
<CODE>
SUM()
</CODE>
),
<CODE>
GROUP BY,
</CODE>
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>
<P>
The next step is for the Query to be modified by any
<CODE>
VIEWS
</CODE>
or
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
<CODE>
RULES
</CODE>
that may apply to the query. This is performed by the
<A
...
@@ -69,21 +69,22 @@ returned to the client.
...
@@ -69,21 +69,22 @@ returned to the client.
There are many other modules that support this basic functionality.
There are many other modules that support this basic functionality.
They can be accessed by clicking on the flowchart.
They can be accessed by clicking on the flowchart.
<P>
<P>
Another area of interest is the shared memory area, containing table
Another area of interest is the shared memory area, which contains data
data/index blocks, locks, backend information, and lookup tables for
accessable to all backends. It has table recently used data/index
these structures:
blocks, locks, backend information, and lookup tables for these
structures:
<UL>
<UL>
<LI>
ShmemIndex - lookup shared memory addresses using structure names
<LI>
ShmemIndex - lookup shared memory addresses using structure names
<LI><A
HREF=
"../../include/storage/buf_internals.h"
>
Buffer
<LI><A
HREF=
"../../include/storage/buf_internals.h"
>
Buffer
Descriptor
s
</A>
- control header for buffer cache block
Descriptor
</A>
- control header for buffer cache block
<LI><A
HREF=
"../../include/storage/buf_internals.h"
>
Buffer Block
s
</A>
-
<LI><A
HREF=
"../../include/storage/buf_internals.h"
>
Buffer Block
</A>
-
data/index buffer cache block
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"
>
table name and block number(
<A
HREF=
"../../include/storage/buf_internals.h"
>
BufferTag
</A>
)
BufferTag
</A>
)
<LI>
MultiLevelLockTable (ctl) -
<A
<LI>
MultiLevelLockTable (ctl) -
control structure for
HREF=
"../../include/storage/lock.h"
>
LOCKCTL
</A>
control structure for
each locking method. Currently, only multi-level locking is used(
<A
each locking method. Currently, only multi-level locking is used
.
HREF=
"../../include/storage/lock.h"
>
LOCKMETHODCTL
</A>
)
.
<LI>
MultiLevelLockTable (lock hash) - the
<A
<LI>
MultiLevelLockTable (lock hash) - the
<A
HREF=
"../../include/storage/lock.h"
>
LOCK
</A>
structure, looked up using
HREF=
"../../include/storage/lock.h"
>
LOCK
</A>
structure, looked up using
relation, database object ids(
<A
relation, database object ids(
<A
...
@@ -105,7 +106,9 @@ Each data structure is created by calling <A
...
@@ -105,7 +106,9 @@ Each data structure is created by calling <A
HREF=
"../../backend/storage/ipc/shmem.c"
>
ShmemInitStruct(),
</A>
and
HREF=
"../../backend/storage/ipc/shmem.c"
>
ShmemInitStruct(),
</A>
and
the lookups are created by
the lookups are created by
<A
HREF=
"../../backend/storage/ipc/shmem.c"
>
ShmemInitHash().
</A>
<A
HREF=
"../../backend/storage/ipc/shmem.c"
>
ShmemInitHash().
</A>
<P>
<HR>
<HR>
<P>
<CENTER>
<CENTER>
<EM><BIG>
<EM><BIG>
Click on an item to see more detail or
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