forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit56788d2
committed
Allocate consecutive blocks during parallel seqscans
Previously we would allocate blocks to parallel workers during a parallelsequential scan 1 block at a time. Since other workers were likely torequest a block before a worker returns for another block number to workon, this could lead to non-sequential I/O patterns in each worker whichcould cause the operating system's readahead to perform poorly or not atall.Here we change things so that we allocate consecutive "chunks" of blocksto workers and have them work on those until they're done, at which timewe allocate another chunk for the worker. The size of these chunks isbased on the size of the relation.Initial patch here was by Thomas Munro which showed some good improvementsjust having a fixed chunk size of 64 blocks with a simple ramp-down nearthe end of the scan. The revisions of the patch to make the chunk sizebased on the relation size and the adjusted ramp-down in powers of two wasdone by me, along with quite extensive benchmarking to determine theoptimal chunk sizes.For the most part, benchmarks have shown significant performanceimprovements for large parallel sequential scans on Linux, FreeBSD andWindows using SSDs. It's less clear how this affects the performance ofcloud providers. Tests done so far are unable to obtain stable enoughperformance to provide meaningful benchmark results. It is possible thatthis could cause some performance regressions on more obscure filesystems,so we may need to later provide users with some ability to get somethingcloser to the old behavior. For now, let's leave that until we see thatit's really required.Author: Thomas Munro, David RowleyReviewed-by: Ranier Vilela, Soumyadeep Chakraborty, Robert HaasReviewed-by: Amit Kapila, Kirk JamisonDiscussion:https://postgr.es/m/CA+hUKGJ_EErDv41YycXcbMbCBkztA34+z1ts9VQH+ACRuvpxig@mail.gmail.com1 parent11a68e4 commit56788d2
4 files changed
+144
-12
lines changedLines changed: 16 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
520 | 520 |
| |
521 | 521 |
| |
522 | 522 |
| |
| 523 | + | |
| 524 | + | |
523 | 525 |
| |
524 | 526 |
| |
525 |
| - | |
| 527 | + | |
526 | 528 |
| |
527 | 529 |
| |
528 |
| - | |
| 530 | + | |
529 | 531 |
| |
530 | 532 |
| |
531 | 533 |
| |
| |||
720 | 722 |
| |
721 | 723 |
| |
722 | 724 |
| |
| 725 | + | |
| 726 | + | |
723 | 727 |
| |
724 | 728 |
| |
725 |
| - | |
| 729 | + | |
726 | 730 |
| |
727 | 731 |
| |
728 | 732 |
| |
| |||
834 | 838 |
| |
835 | 839 |
| |
836 | 840 |
| |
| 841 | + | |
| 842 | + | |
837 | 843 |
| |
838 | 844 |
| |
839 |
| - | |
| 845 | + | |
840 | 846 |
| |
841 | 847 |
| |
842 |
| - | |
| 848 | + | |
843 | 849 |
| |
844 | 850 |
| |
845 | 851 |
| |
| |||
1019 | 1025 |
| |
1020 | 1026 |
| |
1021 | 1027 |
| |
| 1028 | + | |
| 1029 | + | |
1022 | 1030 |
| |
1023 | 1031 |
| |
1024 |
| - | |
| 1032 | + | |
1025 | 1033 |
| |
1026 | 1034 |
| |
1027 | 1035 |
| |
| |||
1155 | 1163 |
| |
1156 | 1164 |
| |
1157 | 1165 |
| |
| 1166 | + | |
| 1167 | + | |
1158 | 1168 |
| |
1159 | 1169 |
| |
1160 | 1170 |
| |
|
Lines changed: 113 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| 28 | + | |
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
31 | 32 |
| |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
32 | 46 |
| |
33 | 47 |
| |
34 | 48 |
| |
| |||
408 | 422 |
| |
409 | 423 |
| |
410 | 424 |
| |
411 |
| - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
412 | 428 |
| |
413 | 429 |
| |
414 | 430 |
| |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
415 | 456 |
| |
416 | 457 |
| |
417 | 458 |
| |
| |||
451 | 492 |
| |
452 | 493 |
| |
453 | 494 |
| |
454 |
| - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
455 | 498 |
| |
456 | 499 |
| |
457 | 500 |
| |
458 | 501 |
| |
459 | 502 |
| |
460 |
| - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
461 | 529 |
| |
462 | 530 |
| |
463 | 531 |
| |
| |||
468 | 536 |
| |
469 | 537 |
| |
470 | 538 |
| |
471 |
| - | |
| 539 | + | |
472 | 540 |
| |
473 | 541 |
| |
474 |
| - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
475 | 583 |
| |
476 | 584 |
| |
477 | 585 |
| |
|
Lines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
45 | 46 |
| |
46 | 47 |
| |
47 |
| - | |
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
84 | 96 |
| |
85 | 97 |
| |
86 | 98 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1793 | 1793 |
| |
1794 | 1794 |
| |
1795 | 1795 |
| |
| 1796 | + | |
1796 | 1797 |
| |
1797 | 1798 |
| |
| 1799 | + | |
1798 | 1800 |
| |
1799 | 1801 |
| |
1800 | 1802 |
| |
|
0 commit comments
Comments
(0)