- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit9c02e3a
committed
pg_dump: Retrieve attribute statistics in batches.
Currently, pg_dump gathers attribute statistics with a query perrelation, which can cause pg_dump to take significantly longer,especially when there are many relations. This commit addressesthis by teaching pg_dump to gather attribute statistics for 64relations at a time. Some simple tests showed this was the optimalbatch size, but performance may vary depending on the workload.Our lookahead code determines the next batch of relations bysearching the TOC sequentially for relevant entries. This approachassumes that we will dump all such entries in TOC order, whichunfortunately isn't true for dump formats that useRestoreArchive(). RestoreArchive() does multiple passes throughthe TOC and selectively dumps certain groups of entries each time.This is particularly problematic for index stats and a subset ofmatview stats; both are in SECTION_POST_DATA, but matview statsthat depend on matview data are dumped in RESTORE_PASS_POST_ACL,while all other stats are dumped in RESTORE_PASS_MAIN. To handlethis, this commit moves all statistics data entries inSECTION_POST_DATA to RESTORE_PASS_POST_ACL, which ensures that wealways dump them in TOC order. A convenient side effect of thischange is that we can revert a decent chunk of commita0a4601,but that is left for a follow-up commit.Author: Corey Huinker <corey.huinker@gmail.com>Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>Reviewed-by: Jeff Davis <pgsql@j-davis.com>Discussion:https://postgr.es/m/CADkLM%3Dc%2Br05srPy9w%2B-%2BnbmLEo15dKXYQ03Q_xyK%2BriJerigLQ%40mail.gmail.com1 parent7d5c83b commit9c02e3a
3 files changed
+142
-39
lines changedLines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
285 | 285 |
| |
286 | 286 |
| |
287 | 287 |
| |
288 |
| - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
289 | 292 |
| |
290 | 293 |
| |
291 | 294 |
| |
|
Lines changed: 11 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2655 | 2655 |
| |
2656 | 2656 |
| |
2657 | 2657 |
| |
2658 |
| - | |
| 2658 | + | |
2659 | 2659 |
| |
2660 | 2660 |
| |
2661 | 2661 |
| |
| |||
3284 | 3284 |
| |
3285 | 3285 |
| |
3286 | 3286 |
| |
3287 |
| - | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
3288 | 3293 |
| |
3289 |
| - | |
3290 |
| - | |
3291 |
| - | |
3292 |
| - | |
3293 |
| - | |
3294 |
| - | |
3295 |
| - | |
3296 |
| - | |
3297 |
| - | |
3298 |
| - | |
3299 |
| - | |
3300 |
| - | |
3301 |
| - | |
3302 |
| - | |
3303 |
| - | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
3304 | 3297 |
| |
3305 | 3298 |
| |
3306 | 3299 |
| |
| |||
3951 | 3944 |
| |
3952 | 3945 |
| |
3953 | 3946 |
| |
3954 |
| - | |
| 3947 | + | |
3955 | 3948 |
| |
3956 | 3949 |
| |
3957 | 3950 |
| |
|
Lines changed: 127 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
209 | 209 |
| |
210 | 210 |
| |
211 | 211 |
| |
| 212 | + | |
| 213 | + | |
| 214 | + | |
212 | 215 |
| |
213 | 216 |
| |
214 | 217 |
| |
| |||
10553 | 10556 |
| |
10554 | 10557 |
| |
10555 | 10558 |
| |
| 10559 | + | |
| 10560 | + | |
| 10561 | + | |
| 10562 | + | |
| 10563 | + | |
| 10564 | + | |
| 10565 | + | |
| 10566 | + | |
| 10567 | + | |
| 10568 | + | |
| 10569 | + | |
| 10570 | + | |
| 10571 | + | |
| 10572 | + | |
| 10573 | + | |
| 10574 | + | |
| 10575 | + | |
| 10576 | + | |
| 10577 | + | |
| 10578 | + | |
| 10579 | + | |
| 10580 | + | |
| 10581 | + | |
| 10582 | + | |
| 10583 | + | |
| 10584 | + | |
| 10585 | + | |
| 10586 | + | |
| 10587 | + | |
| 10588 | + | |
| 10589 | + | |
| 10590 | + | |
| 10591 | + | |
| 10592 | + | |
| 10593 | + | |
| 10594 | + | |
| 10595 | + | |
| 10596 | + | |
| 10597 | + | |
| 10598 | + | |
| 10599 | + | |
| 10600 | + | |
| 10601 | + | |
| 10602 | + | |
| 10603 | + | |
| 10604 | + | |
| 10605 | + | |
| 10606 | + | |
| 10607 | + | |
| 10608 | + | |
| 10609 | + | |
| 10610 | + | |
| 10611 | + | |
| 10612 | + | |
| 10613 | + | |
| 10614 | + | |
| 10615 | + | |
| 10616 | + | |
| 10617 | + | |
| 10618 | + | |
| 10619 | + | |
| 10620 | + | |
| 10621 | + | |
| 10622 | + | |
| 10623 | + | |
| 10624 | + | |
| 10625 | + | |
| 10626 | + | |
| 10627 | + | |
| 10628 | + | |
| 10629 | + | |
10556 | 10630 |
| |
10557 | 10631 |
| |
10558 | 10632 |
| |
| |||
10561 | 10635 |
| |
10562 | 10636 |
| |
10563 | 10637 |
| |
10564 |
| - | |
| 10638 | + | |
10565 | 10639 |
| |
10566 | 10640 |
| |
10567 |
| - | |
10568 |
| - | |
| 10641 | + | |
| 10642 | + | |
10569 | 10643 |
| |
10570 | 10644 |
| |
10571 | 10645 |
| |
| 10646 | + | |
| 10647 | + | |
10572 | 10648 |
| |
10573 | 10649 |
| |
10574 | 10650 |
| |
| |||
10584 | 10660 |
| |
10585 | 10661 |
| |
10586 | 10662 |
| |
| 10663 | + | |
| 10664 | + | |
| 10665 | + | |
| 10666 | + | |
| 10667 | + | |
| 10668 | + | |
| 10669 | + | |
| 10670 | + | |
| 10671 | + | |
| 10672 | + | |
| 10673 | + | |
| 10674 | + | |
| 10675 | + | |
| 10676 | + | |
| 10677 | + | |
| 10678 | + | |
| 10679 | + | |
| 10680 | + | |
10587 | 10681 |
| |
10588 | 10682 |
| |
10589 | 10683 |
| |
10590 | 10684 |
| |
10591 | 10685 |
| |
10592 |
| - | |
10593 |
| - | |
| 10686 | + | |
| 10687 | + | |
10594 | 10688 |
| |
10595 | 10689 |
| |
10596 | 10690 |
| |
| |||
10608 | 10702 |
| |
10609 | 10703 |
| |
10610 | 10704 |
| |
| 10705 | + | |
| 10706 | + | |
| 10707 | + | |
| 10708 | + | |
| 10709 | + | |
| 10710 | + | |
| 10711 | + | |
| 10712 | + | |
10611 | 10713 |
| |
10612 | 10714 |
| |
10613 |
| - | |
10614 |
| - | |
10615 |
| - | |
| 10715 | + | |
| 10716 | + | |
| 10717 | + | |
| 10718 | + | |
| 10719 | + | |
10616 | 10720 |
| |
10617 | 10721 |
| |
10618 | 10722 |
| |
| |||
10642 | 10746 |
| |
10643 | 10747 |
| |
10644 | 10748 |
| |
| 10749 | + | |
| 10750 | + | |
| 10751 | + | |
| 10752 | + | |
| 10753 | + | |
| 10754 | + | |
| 10755 | + | |
10645 | 10756 |
| |
10646 |
| - | |
10647 |
| - | |
10648 |
| - | |
10649 |
| - | |
10650 |
| - | |
10651 |
| - | |
10652 |
| - | |
10653 |
| - | |
10654 |
| - | |
| 10757 | + | |
| 10758 | + | |
10655 | 10759 |
| |
10656 | 10760 |
| |
10657 | 10761 |
| |
| |||
10669 | 10773 |
| |
10670 | 10774 |
| |
10671 | 10775 |
| |
10672 |
| - | |
| 10776 | + | |
10673 | 10777 |
| |
10674 | 10778 |
| |
10675 | 10779 |
| |
| 10780 | + | |
| 10781 | + | |
| 10782 | + | |
| 10783 | + | |
| 10784 | + | |
10676 | 10785 |
| |
10677 | 10786 |
| |
10678 | 10787 |
| |
| |||
10762 | 10871 |
| |
10763 | 10872 |
| |
10764 | 10873 |
| |
10765 |
| - | |
10766 |
| - | |
10767 | 10874 |
| |
10768 | 10875 |
| |
10769 | 10876 |
| |
|
0 commit comments
Comments
(0)