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

Commitdb98918

Browse files
committed
Add comments on avoid reuse of parse-time snapshot
Apparently, reusing the parse-time query snapshot for later steps(execution) is a frequently considered optimization ... but it doesn'twork, for reasons discovered in thread [1]. Adding some comments aboutwhy it doesn't really work can relieve some future hackers from wastingtime reimplementing it again.[1]https://postgr.es/m/flat/5075D8DF.6050500@fuzzy.czAuthor: Michail NikolaevDiscussion:https://postgr.es/m/CANtu0ogp6cTvMJObXP8n=k+JtqxY1iT9UV5MbGCpjjPa5crCiw@mail.gmail.com
1 parent1933ae6 commitdb98918

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,16 @@ exec_simple_query(const char *query_string)
11551155
plantree_list=pg_plan_queries(querytree_list,
11561156
CURSOR_OPT_PARALLEL_OK,NULL);
11571157

1158-
/* Done with the snapshot used for parsing/planning */
1158+
/*
1159+
* Done with the snapshot used for parsing/planning.
1160+
*
1161+
* While it looks promising to reuse the same snapshot for query
1162+
* execution (at least for simple protocol), unfortunately it causes
1163+
* execution to use a snapshot that has been acquired before locking
1164+
* any of the tables mentioned in the query. This creates user-
1165+
* visible anomalies, so refrain. Refer to
1166+
* https://postgr.es/m/flat/5075D8DF.6050500@fuzzy.cz for details.
1167+
*/
11591168
if (snapshot_set)
11601169
PopActiveSnapshot();
11611170

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp