forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8af2565
committed
Introduce a new smgr bulk loading facility.
The new facility makes it easier to optimize bulk loading, as thelogic for buffering, WAL-logging, and syncing the relation only needsto be implemented once. It's also less error-prone: We have had anumber of bugs in how a relation is fsync'd - or not - at the end of abulk loading operation. By centralizing that logic to one place, weonly need to write it correctly once.The new facility is faster for small relations: Instead of of callingsmgrimmedsync(), we register the fsync to happen at next checkpoint,which avoids the fsync latency. That can make a big difference if youare e.g. restoring a schema-only dump with lots of relations.It is also slightly more efficient with large relations, as the WALlogging is performed multiple pages at a time. That avoids some WALheader overhead. The sorted GiST index build did that already, thismoves the buffering to the new facility.The changes to pageinspect GiST test needs an explanation: Before thispatch, the sorted GiST index build set the LSN on every page to thespecial GistBuildLSN value, not the LSN of the WAL record, even thoughthey were WAL-logged. There was no particular need for it, it justhappened naturally when we wrote out the pages before WAL-loggingthem. Now we WAL-log the pages first, like in B-tree build, so thepages are stamped with the record's real LSN. When the build is notWAL-logged, we still use GistBuildLSN. To make the test outputpredictable, use an unlogged index.Reviewed-by: Andres FreundDiscussion:https://www.postgresql.org/message-id/30e8f366-58b3-b239-c521-422122dd5150%40iki.fi1 parente612384 commit8af2565
File tree
17 files changed
+552
-355
lines changed- contrib/pageinspect
- expected
- sql
- src
- backend
- access
- gist
- heap
- nbtree
- spgist
- catalog
- storage/smgr
- include/storage
- tools/pgindent
17 files changed
+552
-355
lines changedLines changed: 3 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
2 |
| - | |
3 |
| - | |
4 |
| - | |
5 |
| - | |
6 |
| - | |
7 |
| - | |
8 |
| - | |
9 |
| - | |
10 |
| - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
11 | 4 |
| |
12 | 5 |
| |
13 | 6 |
| |
| |||
29 | 22 |
| |
30 | 23 |
| |
31 | 24 |
| |
32 |
| - | |
33 | 25 |
| |
34 | 26 |
| |
35 | 27 |
| |
|
Lines changed: 3 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
2 |
| - | |
3 |
| - | |
4 |
| - | |
5 |
| - | |
6 |
| - | |
7 |
| - | |
8 |
| - | |
9 |
| - | |
10 |
| - | |
11 |
| - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
12 | 4 |
| |
13 | 5 |
| |
14 | 6 |
| |
| |||
17 | 9 |
| |
18 | 10 |
| |
19 | 11 |
| |
20 |
| - | |
21 |
| - | |
22 | 12 |
| |
23 | 13 |
| |
24 | 14 |
| |
|
Lines changed: 28 additions & 93 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 |
| - | |
| 46 | + | |
| 47 | + | |
47 | 48 |
| |
48 | 49 |
| |
49 | 50 |
| |
| |||
106 | 107 |
| |
107 | 108 |
| |
108 | 109 |
| |
109 |
| - | |
110 | 110 |
| |
111 |
| - | |
112 |
| - | |
113 |
| - | |
| 111 | + | |
114 | 112 |
| |
115 | 113 |
| |
116 | 114 |
| |
| |||
142 | 140 |
| |
143 | 141 |
| |
144 | 142 |
| |
145 |
| - | |
146 | 143 |
| |
147 | 144 |
| |
148 | 145 |
| |
| |||
405 | 402 |
| |
406 | 403 |
| |
407 | 404 |
| |
408 |
| - | |
| 405 | + | |
409 | 406 |
| |
410 |
| - | |
411 |
| - | |
412 |
| - | |
| 407 | + | |
| 408 | + | |
413 | 409 |
| |
414 |
| - | |
415 |
| - | |
416 |
| - | |
417 |
| - | |
418 |
| - | |
419 |
| - | |
420 |
| - | |
421 |
| - | |
422 |
| - | |
| 410 | + | |
423 | 411 |
| |
424 | 412 |
| |
425 | 413 |
| |
426 |
| - | |
| 414 | + | |
427 | 415 |
| |
428 |
| - | |
| 416 | + | |
429 | 417 |
| |
430 | 418 |
| |
431 | 419 |
| |
| |||
455 | 443 |
| |
456 | 444 |
| |
457 | 445 |
| |
458 |
| - | |
459 |
| - | |
460 | 446 |
| |
461 | 447 |
| |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
470 | 452 |
| |
471 | 453 |
| |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
| 454 | + | |
483 | 455 |
| |
484 | 456 |
| |
485 | 457 |
| |
| |||
509 | 481 |
| |
510 | 482 |
| |
511 | 483 |
| |
512 |
| - | |
513 |
| - | |
| 484 | + | |
514 | 485 |
| |
515 | 486 |
| |
516 | 487 |
| |
| |||
573 | 544 |
| |
574 | 545 |
| |
575 | 546 |
| |
| 547 | + | |
576 | 548 |
| |
577 | 549 |
| |
578 | 550 |
| |
579 | 551 |
| |
580 | 552 |
| |
581 | 553 |
| |
582 | 554 |
| |
583 |
| - | |
| 555 | + | |
| 556 | + | |
584 | 557 |
| |
585 | 558 |
| |
586 | 559 |
| |
| |||
593 | 566 |
| |
594 | 567 |
| |
595 | 568 |
| |
596 |
| - | |
597 |
| - | |
598 |
| - | |
599 |
| - | |
600 |
| - | |
601 |
| - | |
602 |
| - | |
603 |
| - | |
604 |
| - | |
605 |
| - | |
606 |
| - | |
607 |
| - | |
608 |
| - | |
609 |
| - | |
610 | 569 |
| |
611 | 570 |
| |
612 | 571 |
| |
| |||
621 | 580 |
| |
622 | 581 |
| |
623 | 582 |
| |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
624 | 592 |
| |
625 | 593 |
| |
626 | 594 |
| |
| |||
631 | 599 |
| |
632 | 600 |
| |
633 | 601 |
| |
634 |
| - | |
| 602 | + | |
635 | 603 |
| |
636 | 604 |
| |
637 | 605 |
| |
| |||
641 | 609 |
| |
642 | 610 |
| |
643 | 611 |
| |
644 |
| - | |
645 |
| - | |
646 |
| - | |
647 |
| - | |
648 |
| - | |
649 |
| - | |
650 |
| - | |
651 |
| - | |
652 |
| - | |
653 |
| - | |
654 |
| - | |
655 |
| - | |
656 |
| - | |
657 |
| - | |
658 |
| - | |
659 |
| - | |
660 |
| - | |
661 |
| - | |
662 |
| - | |
663 |
| - | |
664 |
| - | |
665 |
| - | |
666 |
| - | |
667 |
| - | |
668 |
| - | |
669 |
| - | |
670 |
| - | |
671 |
| - | |
672 |
| - | |
673 |
| - | |
674 |
| - | |
675 |
| - | |
676 |
| - | |
677 | 612 |
| |
678 | 613 |
| |
679 | 614 |
| |
|
0 commit comments
Comments
(0)