- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitae3df4b
committed
read_stream: Introduce and use optional batchmode support
Submitting IO in larger batches can be more efficient than doing soone-by-one, particularly for many small reads. It does, however, requirethe ReadStreamBlockNumberCB callback to abide by the restrictions of AIObatching (c.f. pgaio_enter_batchmode()). Basically, the callback may not:a) block without first calling pgaio_submit_staged(), unless a to-be-waited-on lock cannot be part of a deadlock, e.g. because it is never held while waiting for IO.b) directly or indirectly start another batch pgaio_enter_batchmode()As this requires care and is nontrivial in some cases, batching is onlyused with explicit opt-in.This patch adds an explicit flag (READ_STREAM_USE_BATCHING) to read_stream anduses it where appropriate.There are two cases where batching would likely be beneficial, but where wearen't using it yet:1) bitmap heap scans, because the callback reads the VM This should soon be solved, because we are planning to remove the use of the VM, due to that not being sound.2) The first phase of heap vacuum This could be made to support batchmode, but would require some care.Reviewed-by: Noah Misch <noah@leadboat.com>Reviewed-by: Thomas Munro <thomas.munro@gmail.com>Discussion:https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt1 parentf4d0730 commitae3df4b
File tree
12 files changed
+129
-12
lines changed- contrib
- amcheck
- pg_prewarm
- pg_visibility
- src
- backend
- access
- gist
- heap
- nbtree
- spgist
- commands
- storage
- aio
- buffer
- include/storage
12 files changed
+129
-12
lines changedLines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
447 | 447 |
| |
448 | 448 |
| |
449 | 449 |
| |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
450 | 454 |
| |
451 |
| - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
452 | 458 |
| |
453 | 459 |
| |
454 | 460 |
| |
455 | 461 |
| |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
456 | 467 |
| |
457 | 468 |
| |
458 | 469 |
| |
|
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
201 |
| - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
202 | 207 |
| |
203 | 208 |
| |
204 | 209 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
526 | 526 |
| |
527 | 527 |
| |
528 | 528 |
| |
529 |
| - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
530 | 536 |
| |
531 | 537 |
| |
532 | 538 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
210 | 210 |
| |
211 | 211 |
| |
212 | 212 |
| |
213 |
| - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
214 | 220 |
| |
215 | 221 |
| |
216 | 222 |
| |
|
Lines changed: 15 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1206 | 1206 |
| |
1207 | 1207 |
| |
1208 | 1208 |
| |
1209 |
| - | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
1210 | 1218 |
| |
1211 | 1219 |
| |
1212 | 1220 |
| |
| |||
1216 | 1224 |
| |
1217 | 1225 |
| |
1218 | 1226 |
| |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1219 | 1233 |
| |
1220 | 1234 |
| |
1221 | 1235 |
| |
|
Lines changed: 18 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1225 | 1225 |
| |
1226 | 1226 |
| |
1227 | 1227 |
| |
1228 |
| - | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1229 | 1234 |
| |
1230 | 1235 |
| |
1231 | 1236 |
| |
| |||
2669 | 2674 |
| |
2670 | 2675 |
| |
2671 | 2676 |
| |
| 2677 | + | |
| 2678 | + | |
2672 | 2679 |
| |
2673 | 2680 |
| |
2674 | 2681 |
| |
| |||
2732 | 2739 |
| |
2733 | 2740 |
| |
2734 | 2741 |
| |
2735 |
| - | |
2736 |
| - | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
2737 | 2752 |
| |
2738 | 2753 |
| |
2739 | 2754 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1064 | 1064 |
| |
1065 | 1065 |
| |
1066 | 1066 |
| |
1067 |
| - | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
1068 | 1074 |
| |
1069 | 1075 |
| |
1070 | 1076 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
822 | 822 |
| |
823 | 823 |
| |
824 | 824 |
| |
825 |
| - | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
826 | 832 |
| |
827 | 833 |
| |
828 | 834 |
| |
|
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1237 | 1237 |
| |
1238 | 1238 |
| |
1239 | 1239 |
| |
1240 |
| - | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1241 | 1246 |
| |
1242 | 1247 |
| |
1243 | 1248 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
| 105 | + | |
105 | 106 |
| |
106 | 107 |
| |
107 | 108 |
| |
| |||
403 | 404 |
| |
404 | 405 |
| |
405 | 406 |
| |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
406 | 416 |
| |
407 | 417 |
| |
408 | 418 |
| |
| |||
450 | 460 |
| |
451 | 461 |
| |
452 | 462 |
| |
| 463 | + | |
| 464 | + | |
453 | 465 |
| |
454 | 466 |
| |
455 | 467 |
| |
| |||
484 | 496 |
| |
485 | 497 |
| |
486 | 498 |
| |
| 499 | + | |
| 500 | + | |
| 501 | + | |
487 | 502 |
| |
488 | 503 |
| |
489 | 504 |
| |
| |||
617 | 632 |
| |
618 | 633 |
| |
619 | 634 |
| |
| 635 | + | |
620 | 636 |
| |
621 | 637 |
| |
622 | 638 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5100 | 5100 |
| |
5101 | 5101 |
| |
5102 | 5102 |
| |
5103 |
| - | |
| 5103 | + | |
| 5104 | + | |
| 5105 | + | |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
5104 | 5110 |
| |
5105 | 5111 |
| |
5106 | 5112 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
45 | 66 |
| |
46 | 67 |
| |
47 | 68 |
| |
|
0 commit comments
Comments
(0)