forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5de890e
committed
Add EXPLAIN (MEMORY) to report planner memory consumption
This adds a new "Memory:" line under the "Planning:" group (whichcurrently only has "Buffers:") when the MEMORY option is specified.In order to make the reporting reasonably accurate, we create a separatememory context for planner activities, to be used only when this optionis given. The total amount of memory allocated by that context isreported as "allocated"; we subtract memory in the context's freelistsfrom that and report that result as "used". We useMemoryContextStatsInternal() to obtain the quantities.The code structure to show buffer usage during planning was not inamazing shape, so I (Álvaro) modified the patch a bit to clean that upin passing.Author: Ashutosh BapatReviewed-by: David Rowley, Andrey Lepikhov, Jian He, Andy FanDiscussion:https://www.postgresql.org/message-id/CAExHW5sZA=5LJ_ZPpRO-w09ck8z9p7eaYAqq3Ks9GDfhrxeWBw@mail.gmail.com1 parent6a1ea02 commit5de890e
File tree
9 files changed
+265
-28
lines changed- contrib/auto_explain
- doc/src/sgml/ref
- src
- backend
- commands
- utils/mmgr
- include
- commands
- utils
- test/regress
- expected
- sql
9 files changed
+265
-28
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
396 | 396 |
| |
397 | 397 |
| |
398 | 398 |
| |
| 399 | + | |
| 400 | + | |
399 | 401 |
| |
400 | 402 |
| |
401 | 403 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
| 47 | + | |
47 | 48 |
| |
48 | 49 |
| |
49 | 50 |
| |
| |||
250 | 251 |
| |
251 | 252 |
| |
252 | 253 |
| |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
253 | 267 |
| |
254 | 268 |
| |
255 | 269 |
| |
|
Lines changed: 126 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
122 |
| - | |
123 |
| - | |
| 122 | + | |
| 123 | + | |
124 | 124 |
| |
| 125 | + | |
| 126 | + | |
125 | 127 |
| |
126 | 128 |
| |
127 | 129 |
| |
| |||
202 | 204 |
| |
203 | 205 |
| |
204 | 206 |
| |
| 207 | + | |
| 208 | + | |
205 | 209 |
| |
206 | 210 |
| |
207 | 211 |
| |
| |||
397 | 401 |
| |
398 | 402 |
| |
399 | 403 |
| |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
400 | 423 |
| |
401 | 424 |
| |
402 | 425 |
| |
| |||
408 | 431 |
| |
409 | 432 |
| |
410 | 433 |
| |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
411 | 440 |
| |
412 | 441 |
| |
413 | 442 |
| |
| |||
417 | 446 |
| |
418 | 447 |
| |
419 | 448 |
| |
420 |
| - | |
| 449 | + | |
| 450 | + | |
421 | 451 |
| |
422 | 452 |
| |
423 | 453 |
| |
| |||
527 | 557 |
| |
528 | 558 |
| |
529 | 559 |
| |
530 |
| - | |
| 560 | + | |
| 561 | + | |
531 | 562 |
| |
532 | 563 |
| |
533 | 564 |
| |
| |||
615 | 646 |
| |
616 | 647 |
| |
617 | 648 |
| |
618 |
| - | |
619 |
| - | |
| 649 | + | |
| 650 | + | |
620 | 651 |
| |
621 | 652 |
| |
622 |
| - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
623 | 670 |
| |
624 | 671 |
| |
625 | 672 |
| |
| |||
2106 | 2153 |
| |
2107 | 2154 |
| |
2108 | 2155 |
| |
2109 |
| - | |
| 2156 | + | |
2110 | 2157 |
| |
2111 | 2158 |
| |
2112 | 2159 |
| |
| |||
2125 | 2172 |
| |
2126 | 2173 |
| |
2127 | 2174 |
| |
2128 |
| - | |
| 2175 | + | |
2129 | 2176 |
| |
2130 | 2177 |
| |
2131 | 2178 |
| |
| |||
3545 | 3592 |
| |
3546 | 3593 |
| |
3547 | 3594 |
| |
3548 |
| - | |
| 3595 | + | |
| 3596 | + | |
| 3597 | + | |
| 3598 | + | |
| 3599 | + | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
| 3612 | + | |
| 3613 | + | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
| 3620 | + | |
| 3621 | + | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
| 3634 | + | |
| 3635 | + | |
| 3636 | + | |
| 3637 | + | |
3549 | 3638 |
| |
3550 | 3639 |
| |
3551 |
| - | |
| 3640 | + | |
3552 | 3641 |
| |
3553 | 3642 |
| |
3554 | 3643 |
| |
| |||
3568 | 3657 |
| |
3569 | 3658 |
| |
3570 | 3659 |
| |
3571 |
| - | |
3572 |
| - | |
3573 |
| - | |
3574 |
| - | |
3575 |
| - | |
3576 |
| - | |
3577 |
| - | |
3578 |
| - | |
3579 |
| - | |
3580 |
| - | |
3581 |
| - | |
3582 |
| - | |
3583 | 3660 |
| |
3584 | 3661 |
| |
3585 | 3662 |
| |
| |||
3678 | 3755 |
| |
3679 | 3756 |
| |
3680 | 3757 |
| |
3681 |
| - | |
3682 |
| - | |
3683 |
| - | |
3684 | 3758 |
| |
3685 | 3759 |
| |
3686 | 3760 |
| |
| |||
3766 | 3840 |
| |
3767 | 3841 |
| |
3768 | 3842 |
| |
| 3843 | + | |
| 3844 | + | |
| 3845 | + | |
| 3846 | + | |
| 3847 | + | |
| 3848 | + | |
| 3849 | + | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
3769 | 3869 |
| |
3770 | 3870 |
| |
3771 | 3871 |
| |
|
Lines changed: 21 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
583 | 583 |
| |
584 | 584 |
| |
585 | 585 |
| |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
586 | 599 |
| |
587 | 600 |
| |
588 | 601 |
| |
| |||
624 | 637 |
| |
625 | 638 |
| |
626 | 639 |
| |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
627 | 646 |
| |
628 | 647 |
| |
629 | 648 |
| |
| |||
640 | 659 |
| |
641 | 660 |
| |
642 | 661 |
| |
643 |
| - | |
| 662 | + | |
| 663 | + | |
644 | 664 |
| |
645 | 665 |
| |
646 | 666 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
687 | 687 |
| |
688 | 688 |
| |
689 | 689 |
| |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
690 | 703 |
| |
691 | 704 |
| |
692 | 705 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
| 48 | + | |
48 | 49 |
| |
49 | 50 |
| |
50 | 51 |
| |
| |||
92 | 93 |
| |
93 | 94 |
| |
94 | 95 |
| |
95 |
| - | |
| 96 | + | |
| 97 | + | |
96 | 98 |
| |
97 | 99 |
| |
98 | 100 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
| 87 | + | |
| 88 | + | |
87 | 89 |
| |
88 | 90 |
| |
89 | 91 |
| |
|
0 commit comments
Comments
(0)