forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5ead85f
committed
Show index search count in EXPLAIN ANALYZE.
Expose the count of index searches/index descents in EXPLAIN ANALYZE'soutput for index scan nodes. This information is particularly usefulwith scans that use ScalarArrayOp quals, where the number of index scansisn't predictable in advance (at least not with optimizations like theone added to nbtree by Postgres 17 commit5bf748b). It will also beuseful when EXPLAIN ANALYZE shows details of an nbtree index scan thatuses skip scan optimizations set to be introduced by an upcoming patch.The instrumentation works by teaching index AMs to increment a newnsearches counter whenever a new index search begins. The counter isincremented at exactly the same point that index AMs must alreadyincrement the index's pg_stat_*_indexes.idx_scan counter (we're countingthe same event, but at the scan level rather than the relation level).The new counter is stored in the scan descriptor (IndexScanDescData),which explain.c reaches by going through the scan node's PlanState.This approach doesn't match the approach used when tracking other indexscan specific costs (e.g., "Rows Removed by Filter:"). It is similar tothe approach used in other cases where we must track costs that are onlyreadily accessible inside an access method, and not from the executor(e.g., "Heap Blocks:" output for a Bitmap Heap Scan). It is inherentlynecessary to maintain a counter that can be incremented multiple timesduring a single amgettuple call (or amgetbitmap call), and directlyexposing PlanState.instrument to index access methods seems unappealing.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Tomas Vondra <tomas@vondra.me>Reviewed-By: Robert Haas <robertmhaas@gmail.com>Reviewed-By: Masahiro Ikeda <ikedamsh@oss.nttdata.com>Reviewed-By: Matthias van de Meent <boekewurm+postgres@gmail.com>Discussion:https://postgr.es/m/CAH2-Wz=PKR6rB7qbx+Vnd7eqeB5VTcrW=iJvAsTsKbdG+kW_UA@mail.gmail.comDiscussion:https://postgr.es/m/CAH2-WzkRqvaqR2CTNqTZP0z6FuL4-3ED6eQB0yx38XBNj1v-4Q@mail.gmail.com1 parent635f580 commit5ead85f
File tree
22 files changed
+310
-49
lines changed- contrib/bloom
- doc/src/sgml
- ref
- src
- backend
- access
- brin
- gin
- gist
- hash
- index
- nbtree
- spgist
- commands
- include/access
- test/regress
- expected
- sql
22 files changed
+310
-49
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
116 | 116 |
| |
117 | 117 |
| |
118 | 118 |
| |
| 119 | + | |
119 | 120 |
| |
120 | 121 |
| |
121 | 122 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
173 | 173 |
| |
174 | 174 |
| |
175 | 175 |
| |
| 176 | + | |
176 | 177 |
| |
177 | 178 |
| |
178 | 179 |
| |
179 |
| - | |
| 180 | + | |
180 | 181 |
| |
181 | 182 |
| |
182 | 183 |
| |
| |||
208 | 209 |
| |
209 | 210 |
| |
210 | 211 |
| |
| 212 | + | |
211 | 213 |
| |
212 | 214 |
| |
213 | 215 |
| |
| 216 | + | |
214 | 217 |
| |
215 | 218 |
| |
216 | 219 |
| |
217 |
| - | |
| 220 | + | |
218 | 221 |
| |
219 | 222 |
| |
220 | 223 |
| |
|
Lines changed: 22 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4234 | 4234 |
| |
4235 | 4235 |
| |
4236 | 4236 |
| |
4237 |
| - | |
4238 |
| - | |
4239 |
| - | |
4240 |
| - | |
4241 |
| - | |
4242 |
| - | |
| 4237 | + | |
| 4238 | + | |
4243 | 4239 |
| |
4244 | 4240 |
| |
4245 | 4241 |
| |
| 4242 | + | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + | |
| 4248 | + | |
| 4249 | + | |
| 4250 | + | |
| 4251 | + | |
| 4252 | + | |
| 4253 | + | |
4246 | 4254 |
| |
| 4255 | + | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
4247 | 4263 |
| |
4248 | 4264 |
| |
4249 | 4265 |
| |
|
Lines changed: 60 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
729 | 729 |
| |
730 | 730 |
| |
731 | 731 |
| |
| 732 | + | |
732 | 733 |
| |
733 | 734 |
| |
734 | 735 |
| |
| 736 | + | |
735 | 737 |
| |
736 | 738 |
| |
737 | 739 |
| |
| |||
790 | 792 |
| |
791 | 793 |
| |
792 | 794 |
| |
| 795 | + | |
793 | 796 |
| |
794 | 797 |
| |
795 | 798 |
| |
| |||
805 | 808 |
| |
806 | 809 |
| |
807 | 810 |
| |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
808 | 863 |
| |
809 | 864 |
| |
810 | 865 |
| |
| |||
861 | 916 |
| |
862 | 917 |
| |
863 | 918 |
| |
| 919 | + | |
864 | 920 |
| |
865 | 921 |
| |
866 | 922 |
| |
| |||
894 | 950 |
| |
895 | 951 |
| |
896 | 952 |
| |
| 953 | + | |
897 | 954 |
| |
898 | 955 |
| |
| 956 | + | |
899 | 957 |
| |
900 | 958 |
| |
901 | 959 |
| |
| |||
923 | 981 |
| |
924 | 982 |
| |
925 | 983 |
| |
| 984 | + | |
926 | 985 |
| |
927 | 986 |
| |
928 | 987 |
| |
| |||
1061 | 1120 |
| |
1062 | 1121 |
| |
1063 | 1122 |
| |
| 1123 | + | |
1064 | 1124 |
| |
1065 | 1125 |
| |
1066 | 1126 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
506 | 506 |
| |
507 | 507 |
| |
508 | 508 |
| |
| 509 | + | |
509 | 510 |
| |
510 | 511 |
| |
511 | 512 |
| |
512 |
| - | |
| 513 | + | |
513 | 514 |
| |
514 | 515 |
| |
515 | 516 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1046 | 1046 |
| |
1047 | 1047 |
| |
1048 | 1048 |
| |
| 1049 | + | |
1049 | 1050 |
| |
1050 | 1051 |
| |
1051 | 1052 |
| |
| |||
1090 | 1091 |
| |
1091 | 1092 |
| |
1092 | 1093 |
| |
| 1094 | + | |
1093 | 1095 |
| |
1094 | 1096 |
| |
1095 | 1097 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
591 | 591 |
| |
592 | 592 |
| |
593 | 593 |
| |
| 594 | + | |
594 | 595 |
| |
595 | 596 |
| |
596 | 597 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
437 | 437 |
| |
438 | 438 |
| |
439 | 439 |
| |
| 440 | + | |
440 | 441 |
| |
441 | 442 |
| |
442 | 443 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
625 | 625 |
| |
626 | 626 |
| |
627 | 627 |
| |
| 628 | + | |
628 | 629 |
| |
629 | 630 |
| |
630 | 631 |
| |
| |||
750 | 751 |
| |
751 | 752 |
| |
752 | 753 |
| |
| 754 | + | |
753 | 755 |
| |
754 | 756 |
| |
755 | 757 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
298 | 298 |
| |
299 | 299 |
| |
300 | 300 |
| |
| 301 | + | |
301 | 302 |
| |
302 | 303 |
| |
303 | 304 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
| 122 | + | |
122 | 123 |
| |
123 | 124 |
| |
124 | 125 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
| 73 | + | |
73 | 74 |
| |
74 | 75 |
| |
75 | 76 |
| |
| |||
557 | 558 |
| |
558 | 559 |
| |
559 | 560 |
| |
| 561 | + | |
560 | 562 |
| |
561 | 563 |
| |
562 | 564 |
| |
| |||
583 | 585 |
| |
584 | 586 |
| |
585 | 587 |
| |
| 588 | + | |
586 | 589 |
| |
587 | 590 |
| |
588 | 591 |
| |
| |||
676 | 679 |
| |
677 | 680 |
| |
678 | 681 |
| |
| 682 | + | |
679 | 683 |
| |
680 | 684 |
| |
681 | 685 |
| |
| |||
712 | 716 |
| |
713 | 717 |
| |
714 | 718 |
| |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
715 | 724 |
| |
716 | 725 |
| |
717 | 726 |
| |
| |||
810 | 819 |
| |
811 | 820 |
| |
812 | 821 |
| |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
813 | 828 |
| |
814 | 829 |
| |
815 | 830 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
950 | 950 |
| |
951 | 951 |
| |
952 | 952 |
| |
| 953 | + | |
953 | 954 |
| |
954 | 955 |
| |
955 | 956 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
421 | 421 |
| |
422 | 422 |
| |
423 | 423 |
| |
| 424 | + | |
424 | 425 |
| |
425 | 426 |
| |
426 | 427 |
| |
|
0 commit comments
Comments
(0)