- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit933848d
committed
Add missing query ID reporting in extended query protocol
This commit adds query ID reports for two code paths when processingextended query protocol messages:- When receiving a bind message, setting it to the first Query retrievedfrom a cached cache.- When receiving an execute message, setting it to the first PlannedStmtstored in a portal.An advantage of this method is that this is able to cover all the typesof portals handled in the extended query protocol, particularly thesetwo when the report done in ExecutorStart() is not enough (neither is anaddition in ExecutorRun(), actually, for the second point):- Multiple execute messages, with multiple ExecutorRun().- Portal with execute/fetch messages, like a query with a RETURNINGclause and a fetch size that stores the tuples in a first executemessage going though ExecutorStart() and ExecuteRun(), followed by oneor more execute messages doing only fetches from the tuplestore createdin the first message. This corresponds to the case whereexecute_is_fetch is set, for example.Note that the query ID reporting done in ExecutorStart() is stillnecessary, as an EXECUTE requires it. Query ID reporting is optimisticand more calls to pgstat_report_query_id() don't matter as the firstreport takes priority except if the report is forced. The comment inExecutorStart() is adjusted to reflect better the reality with theextended query protocol.The test added in pg_stat_statements is a courtesy of Robert Haas. Thisuses psql's \bind metacommand, hence this part is backpatched down tov16.Reported-by: Kaido Vaikla, Erik WienholdAuthor: Sami ImseihReviewed-by: Jian He, Andrei Lepikhov, Michael PaquierDiscussion:https://postgr.es/m/CA+427g8DiW3aZ6pOpVgkPbqK97ouBdf18VLiHFesea2jUk3XoQ@mail.gmail.comDiscussion:https://postgr.es/m/CA+TgmoZxtnf_jZ=VqBSyaU8hfUkkwoJCJ6ufy4LGpXaunKrjrg@mail.gmail.comDiscussion:https://postgr.es/m/1391613709.939460.1684777418070@office.mailbox.orgBackpatch-through: 141 parent70d38e3 commit933848d
File tree
4 files changed
+42
-4
lines changed- contrib/pg_stat_statements
- expected
- sql
- src/backend
- executor
- tcop
4 files changed
+42
-4
lines changedLines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
3 | 11 |
| |
4 | 12 |
| |
5 | 13 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 |
| |
6 | 10 |
| |
7 | 11 |
| |
|
Lines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
126 | 128 |
| |
127 | 129 |
| |
128 | 130 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1654 | 1654 |
| |
1655 | 1655 |
| |
1656 | 1656 |
| |
| 1657 | + | |
1657 | 1658 |
| |
1658 | 1659 |
| |
1659 | 1660 |
| |
| |||
1689 | 1690 |
| |
1690 | 1691 |
| |
1691 | 1692 |
| |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
1692 | 1704 |
| |
1693 | 1705 |
| |
1694 | 1706 |
| |
| |||
2111 | 2123 |
| |
2112 | 2124 |
| |
2113 | 2125 |
| |
| 2126 | + | |
2114 | 2127 |
| |
2115 | 2128 |
| |
2116 | 2129 |
| |
| |||
2157 | 2170 |
| |
2158 | 2171 |
| |
2159 | 2172 |
| |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
2160 | 2184 |
| |
2161 | 2185 |
| |
2162 | 2186 |
| |
|
0 commit comments
Comments
(0)