Commit c6679e4
committed
Optimize update of tables with generated columns
When updating a table row with generated columns, only recompute those
generated columns whose base columns have changed in this update and
keep the rest unchanged. This can result in a significant performance
benefit. The required information was already kept in
RangeTblEntry.extraUpdatedCols; we just have to make use of it.
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/b05e781a-fa16-6b52-6738-761181204567@2ndquadrant.com1 parent ad3ae64 commit c6679e4Copy full SHA for c6679e4
File tree
Expand file treeCollapse file tree
5 files changed
+38
-10
lines changedOpen diff view settings
Filter options
- src
- backend
- commands
- executor
- include
- executor
- nodes
Expand file treeCollapse file tree
5 files changed
+38
-10
lines changedOpen diff view settings
Collapse file
src/backend/commands/copy.c
Copy file name to clipboardExpand all lines: src/backend/commands/copy.c+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3222 | 3222 | |
3223 | 3223 | |
3224 | 3224 | |
3225 | | - |
| 3225 | + |
3226 | 3226 | |
3227 | 3227 | |
3228 | 3228 | |
|
Collapse file
src/backend/executor/execReplication.c
Copy file name to clipboardExpand all lines: src/backend/executor/execReplication.c+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
419 | 419 | |
420 | 420 | |
421 | 421 | |
422 | | - |
| 422 | + |
423 | 423 | |
424 | 424 | |
425 | 425 | |
| ||
485 | 485 | |
486 | 486 | |
487 | 487 | |
488 | | - |
| 488 | + |
489 | 489 | |
490 | 490 | |
491 | 491 | |
|
Collapse file
src/backend/executor/nodeModifyTable.c
Copy file name to clipboardExpand all lines: src/backend/executor/nodeModifyTable.c+31-6Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
246 | 246 | |
247 | 247 | |
248 | 248 | |
249 | | - |
| 249 | + |
250 | 250 | |
251 | 251 | |
252 | 252 | |
| ||
269 | 269 | |
270 | 270 | |
271 | 271 | |
| 272 | + |
272 | 273 | |
273 | 274 | |
274 | 275 | |
275 | 276 | |
276 | 277 | |
277 | 278 | |
278 | 279 | |
| 280 | + |
| 281 | + |
| 282 | + |
| 283 | + |
| 284 | + |
| 285 | + |
| 286 | + |
| 287 | + |
| 288 | + |
| 289 | + |
| 290 | + |
| 291 | + |
| 292 | + |
| 293 | + |
| 294 | + |
279 | 295 | |
280 | 296 | |
281 | 297 | |
282 | 298 | |
283 | 299 | |
284 | 300 | |
| 301 | + |
285 | 302 | |
286 | 303 | |
287 | 304 | |
288 | 305 | |
289 | 306 | |
290 | 307 | |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
291 | 315 | |
292 | 316 | |
293 | 317 | |
| ||
300 | 324 | |
301 | 325 | |
302 | 326 | |
303 | | - |
| 327 | + |
| 328 | + |
304 | 329 | |
305 | 330 | |
306 | 331 | |
| ||
392 | 417 | |
393 | 418 | |
394 | 419 | |
395 | | - |
| 420 | + |
396 | 421 | |
397 | 422 | |
398 | 423 | |
| ||
427 | 452 | |
428 | 453 | |
429 | 454 | |
430 | | - |
| 455 | + |
431 | 456 | |
432 | 457 | |
433 | 458 | |
| ||
1088 | 1113 | |
1089 | 1114 | |
1090 | 1115 | |
1091 | | - |
| 1116 | + |
1092 | 1117 | |
1093 | 1118 | |
1094 | 1119 | |
| ||
1125 | 1150 | |
1126 | 1151 | |
1127 | 1152 | |
1128 | | - |
| 1153 | + |
1129 | 1154 | |
1130 | 1155 | |
1131 | 1156 | |
|
Collapse file
src/include/executor/nodeModifyTable.h
Copy file name to clipboardExpand all lines: src/include/executor/nodeModifyTable.h+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | | - |
| 18 | + |
19 | 19 | |
20 | 20 | |
21 | 21 | |
|
Collapse file
src/include/nodes/execnodes.h
Copy file name to clipboardExpand all lines: src/include/nodes/execnodes.h+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
457 | 457 | |
458 | 458 | |
459 | 459 | |
| 460 | + |
| 461 | + |
| 462 | + |
460 | 463 | |
461 | 464 | |
462 | 465 | |
|
0 commit comments