forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3db72eb
committed
Generate code for query jumbling through gen_node_support.pl
This commit changes the query jumbling code in queryjumblefuncs.c to begenerated automatically based on the information of the nodes in theheaders of src/include/nodes/ by using gen_node_support.pl. Thisapproach offers many advantages:- Support for query jumbling for all the utility statements, based on thestate of their parsed Nodes and not only their query string. This willgreatly ease the switch to normalize the information of some DDLs, likeSET or CALL for example (this is left unchanged and should be part of aseparate discussion). With this feature, the number of entries storedfor utilities in pg_stat_statements is reduced (for example now"CHECKPOINT" and "checkpoint" mean the same thing with the same queryID).- Documentation of query jumbling directly in the structure definitionof the nodes. Since this code has been introduced in pg_stat_statementsand then moved to code, the reasons behind the choices of what should beincluded in the jumble are rather sparse. Note that some explanation isadded for the most relevant parts, as a start.- Overall code reduction and more consistency with the other partsgenerating read, write and copy depending on the nodes.The query jumbling is controlled by a couple of new node attributes,documented in nodes/nodes.h:- custom_query_jumble, to mark a Node as having a customimplementation.- no_query_jumble, to ignore entirely a Node.- query_jumble_ignore, to ignore a field in a Node.- query_jumble_location, to mark a location in a Node, fornormalization. This can apply only to int fields, with "location" intheir name (only Const as of this commit).There should be no compatibility impact on pg_stat_statements, as thenew code applies the jumbling to the same fields for each node (itsregression tests have no modification, for one).Some benchmark of the query jumbling between HEAD and this commit forSELECT and DMLs has proved that this new code does not cause aperformance regression, with computation times close for both methods.For utility queries, the new method is slower than the previous methodof calculating a hash of the query string, though we are talking aboutextra ns-level changes based on what I measured, which is unnoticeableeven for OLTP workloads as a query ID is calculated once per querypost-parse analysis.Author: Michael PaquierReviewed-by: Peter EisentrautDiscussion:https://postgr.es/m/Y5BHOUhX3zTH/ig6@paquier.xyz1 parent8c1cd72 commit3db72eb
File tree
10 files changed
+503
-832
lines changed- contrib/pg_stat_statements
- expected
- sql
- src
- backend/nodes
- include/nodes
10 files changed
+503
-832
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
571 | 571 |
| |
572 | 572 |
| |
573 | 573 |
| |
| 574 | + | |
574 | 575 |
| |
575 |
| - | |
| 576 | + | |
576 | 577 |
| |
577 | 578 |
| |
578 | 579 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
265 | 265 |
| |
266 | 266 |
| |
267 | 267 |
| |
| 268 | + | |
268 | 269 |
| |
269 |
| - | |
| 270 | + | |
270 | 271 |
| |
271 | 272 |
| |
272 | 273 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
| 54 | + | |
54 | 55 |
| |
55 | 56 |
| |
56 | 57 |
| |
|
Lines changed: 113 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
| 124 | + | |
| 125 | + | |
124 | 126 |
| |
125 | 127 |
| |
126 | 128 |
| |
| |||
155 | 157 |
| |
156 | 158 |
| |
157 | 159 |
| |
158 |
| - | |
| 160 | + | |
159 | 161 |
| |
160 | 162 |
| |
161 | 163 |
| |
162 | 164 |
| |
163 | 165 |
| |
| 166 | + | |
164 | 167 |
| |
165 | 168 |
| |
166 | 169 |
| |
| |||
170 | 173 |
| |
171 | 174 |
| |
172 | 175 |
| |
| 176 | + | |
| 177 | + | |
| 178 | + | |
173 | 179 |
| |
174 | 180 |
| |
175 | 181 |
| |
| |||
319 | 325 |
| |
320 | 326 |
| |
321 | 327 |
| |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
322 | 332 |
| |
323 | 333 |
| |
324 | 334 |
| |
| |||
332 | 342 |
| |
333 | 343 |
| |
334 | 344 |
| |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
335 | 349 |
| |
336 | 350 |
| |
337 | 351 |
| |
| |||
457 | 471 |
| |
458 | 472 |
| |
459 | 473 |
| |
| 474 | + | |
| 475 | + | |
460 | 476 |
| |
461 | 477 |
| |
462 | 478 |
| |
| |||
1225 | 1241 |
| |
1226 | 1242 |
| |
1227 | 1243 |
| |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
1228 | 1340 |
| |
1229 | 1341 |
| |
1230 | 1342 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
14 | 13 |
| |
15 | 14 |
| |
16 | 15 |
| |
| |||
21 | 20 |
| |
22 | 21 |
| |
23 | 22 |
| |
| 23 | + | |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
|
0 commit comments
Comments
(0)