forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7c91a03
committed
Sync up our various ways of estimating pg_class.reltuples.
VACUUM thought that reltuples represents the total number of tuples inthe relation, while ANALYZE counted only live tuples. This can cause"flapping" in the value when background vacuums and analyzes happenseparately. The planner's use of reltuples essentially assumes thatit's the count of live (visible) tuples, so let's standardize on havingit mean live tuples.Another issue is that the definition of "live tuple" isn't totally clear;what should be done with INSERT_IN_PROGRESS or DELETE_IN_PROGRESS tuples?ANALYZE's choices in this regard are made on the assumption that if theoriginating transaction commits at all, it will happen after ANALYZEfinishes, so we should ignore the effects of the in-progress transaction--- unless it is our own transaction, and then we should count it.Let's propagate this definition into VACUUM, too.Likewise propagate this definition into CREATE INDEX, and intocontrib/pgstattuple's pgstattuple_approx() function.Tomas Vondra, reviewed by Haribabu Kommi, some corrections by meDiscussion:https://postgr.es/m/16db4468-edfa-830a-f921-39a50498e77e@2ndquadrant.com1 parentcc415a5 commit7c91a03
File tree
5 files changed
+132
-52
lines changed- contrib/pgstattuple
- doc/src/sgml
- src/backend
- catalog
- commands
5 files changed
+132
-52
lines changedLines changed: 21 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
72 | 71 |
| |
73 | 72 |
| |
74 | 73 |
| |
| |||
114 | 113 |
| |
115 | 114 |
| |
116 | 115 |
| |
| 116 | + | |
| 117 | + | |
| 118 | + | |
117 | 119 |
| |
118 | 120 |
| |
119 | 121 |
| |
120 | 122 |
| |
121 | 123 |
| |
122 | 124 |
| |
123 |
| - | |
124 |
| - | |
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
| |||
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
156 |
| - | |
157 |
| - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
158 | 160 |
| |
159 | 161 |
| |
160 | 162 |
| |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 | 163 |
| |
| 164 | + | |
169 | 165 |
| |
170 | 166 |
| |
171 | 167 |
| |
| 168 | + | |
| 169 | + | |
172 | 170 |
| |
173 |
| - | |
174 |
| - | |
| 171 | + | |
| 172 | + | |
175 | 173 |
| |
176 | 174 |
| |
177 | 175 |
| |
| |||
184 | 182 |
| |
185 | 183 |
| |
186 | 184 |
| |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
187 | 193 |
| |
188 |
| - | |
| 194 | + | |
189 | 195 |
| |
190 | 196 |
| |
191 | 197 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1739 | 1739 |
| |
1740 | 1740 |
| |
1741 | 1741 |
| |
1742 |
| - | |
1743 |
| - | |
| 1742 | + | |
| 1743 | + | |
1744 | 1744 |
| |
1745 | 1745 |
| |
1746 | 1746 |
| |
|
Lines changed: 40 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2366 | 2366 |
| |
2367 | 2367 |
| |
2368 | 2368 |
| |
2369 |
| - | |
2370 |
| - | |
2371 |
| - | |
2372 |
| - | |
2373 |
| - | |
2374 |
| - | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
2375 | 2375 |
| |
2376 | 2376 |
| |
2377 | 2377 |
| |
| |||
2402 | 2402 |
| |
2403 | 2403 |
| |
2404 | 2404 |
| |
2405 |
| - | |
2406 |
| - | |
| 2405 | + | |
| 2406 | + | |
2407 | 2407 |
| |
2408 | 2408 |
| |
2409 | 2409 |
| |
| |||
2599 | 2599 |
| |
2600 | 2600 |
| |
2601 | 2601 |
| |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
2602 | 2608 |
| |
2603 | 2609 |
| |
2604 | 2610 |
| |
| |||
2611 | 2617 |
| |
2612 | 2618 |
| |
2613 | 2619 |
| |
| 2620 | + | |
| 2621 | + | |
2614 | 2622 |
| |
2615 | 2623 |
| |
2616 | 2624 |
| |
| |||
2624 | 2632 |
| |
2625 | 2633 |
| |
2626 | 2634 |
| |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
2627 | 2638 |
| |
2628 | 2639 |
| |
2629 | 2640 |
| |
| |||
2646 | 2657 |
| |
2647 | 2658 |
| |
2648 | 2659 |
| |
| 2660 | + | |
2649 | 2661 |
| |
2650 | 2662 |
| |
2651 | 2663 |
| |
| |||
2683 | 2695 |
| |
2684 | 2696 |
| |
2685 | 2697 |
| |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
2686 | 2707 |
| |
2687 | 2708 |
| |
2688 | 2709 |
| |
| |||
2702 | 2723 |
| |
2703 | 2724 |
| |
2704 | 2725 |
| |
| 2726 | + | |
2705 | 2727 |
| |
2706 | 2728 |
| |
2707 | 2729 |
| |
| |||
2745 | 2767 |
| |
2746 | 2768 |
| |
2747 | 2769 |
| |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
2748 | 2778 |
| |
2749 | 2779 |
| |
2750 | 2780 |
| |
| |||
2762 | 2792 |
| |
2763 | 2793 |
| |
2764 | 2794 |
| |
2765 |
| - | |
2766 |
| - | |
| 2795 | + | |
| 2796 | + | |
2767 | 2797 |
| |
2768 | 2798 |
| |
2769 | 2799 |
| |
| |||
2787 | 2817 |
| |
2788 | 2818 |
| |
2789 | 2819 |
| |
2790 |
| - | |
2791 |
| - | |
2792 | 2820 |
| |
2793 | 2821 |
| |
2794 | 2822 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
771 | 771 |
| |
772 | 772 |
| |
773 | 773 |
| |
| 774 | + | |
| 775 | + | |
| 776 | + | |
774 | 777 |
| |
775 | 778 |
| |
776 | 779 |
| |
| |||
852 | 855 |
| |
853 | 856 |
| |
854 | 857 |
| |
| 858 | + | |
| 859 | + | |
| 860 | + | |
855 | 861 |
| |
856 | 862 |
| |
857 | 863 |
| |
|
0 commit comments
Comments
(0)