Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01334c9

Browse files
committed
doc: expand description of how non-SELECT queries are processed
The previous description of how the executor processes non-SELECTqueries was very dense, causing lack of clarity. This expanded textspells it out more simply.Reported-by: fotis.koutoupas@gmail.comDiscussion:https://postgr.es/m/160912275508.676.17469511338925622905@wrigleys.postgresql.orgBackpatch-through: 9.5
1 parente33d004 commit01334c9

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

‎doc/src/sgml/arch-dev.sgml

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -529,26 +529,36 @@
529529
</para>
530530

531531
<para>
532-
The executor mechanism is used to evaluate all four basic SQL query types:
533-
<command>SELECT</command>, <command>INSERT</command>, <command>UPDATE</command>, and
534-
<command>DELETE</command>. For <command>SELECT</command>, the top-level executor
535-
code only needs to send each row returned by the query plan tree off
536-
to the client. For <command>INSERT</command>, each returned row is inserted
537-
into the target table specified for the <command>INSERT</command>. This is
538-
done in a special top-level plan node called <literal>ModifyTable</literal>.
539-
(A simple
540-
<command>INSERT ... VALUES</command> command creates a trivial plan tree
541-
consisting of a single <literal>Result</literal> node, which computes just one
542-
result row, and <literal>ModifyTable</literal> above it to perform the insertion.
543-
But <command>INSERT ... SELECT</command> can demand the full power
544-
of the executor mechanism.) For <command>UPDATE</command>, the planner arranges
545-
that each computed row includes all the updated column values, plus
546-
the <firstterm>TID</firstterm> (tuple ID, or row ID) of the original target row;
547-
this data is fed into a <literal>ModifyTable</literal> node, which uses the
548-
information to create a new updated row and mark the old row deleted.
549-
For <command>DELETE</command>, the only column that is actually returned by the
550-
plan is the TID, and the <literal>ModifyTable</literal> node simply uses the TID
551-
to visit each target row and mark it deleted.
532+
The executor mechanism is used to evaluate all four basic SQL query
533+
types: <command>SELECT</command>, <command>INSERT</command>,
534+
<command>UPDATE</command>, and <command>DELETE</command>.
535+
For <command>SELECT</command>, the top-level executor code
536+
only needs to send each row returned by the query plan tree
537+
off to the client. <command>INSERT ... SELECT</command>,
538+
<command>UPDATE</command>, and <command>DELETE</command>
539+
are effectively <command>SELECT</command>s under a special
540+
top-level plan node called <literal>ModifyTable</literal>.
541+
</para>
542+
543+
<para>
544+
<command>INSERT ... SELECT</command> feeds the rows up
545+
to <literal>ModifyTable</literal> for insertion. For
546+
<command>UPDATE</command>, the planner arranges that each
547+
computed row includes all the updated column values, plus the
548+
<firstterm>TID</firstterm> (tuple ID, or row ID) of the original
549+
target row; this data is fed up to the <literal>ModifyTable</literal>
550+
node, which uses the information to create a new updated row and
551+
mark the old row deleted. For <command>DELETE</command>, the only
552+
column that is actually returned by the plan is the TID, and the
553+
<literal>ModifyTable</literal> node simply uses the TID to visit each
554+
target row and mark it deleted.
555+
</para>
556+
557+
<para>
558+
A simple <command>INSERT ... VALUES</command> command creates a
559+
trivial plan tree consisting of a single <literal>Result</literal>
560+
node, which computes just one result row, feeding that up
561+
to<literal>ModifyTable</literal> to perform the insertion.
552562
</para>
553563

554564
</sect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp