forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc00c54a
committed
Fix nbtree pgstats accounting with parallel scans.
Commit5bf748b, which enhanced nbtree ScalarArrayOp execution, madeparallel index scans work with the new design for arrays via explicitscheduling of primitive index scans. Under this scheme a parallel indexscan with array keys will perform the same number of index descents asan equivalent serial index scan (barring corner cases where anindividual parallel worker discovers that it can advance the scan'sarray keys without anybody needing to perform another descent of theindex to get to the relevant page on the leaf level).Despite all this, the pgstats accounting wasn't updated; it continued toincrement the total number of index scans for the rel once per _bt_firstcall, no matter the details. As a result, the number of (primitive)index scans could be over-counted during parallel scans.To fix, delay incrementing the count of index scans until after we'veestablished that another descent of the index (using either _bt_searchor _bt_endpoint) is required. That way pg_stat_user_tables.idx_scanalways advances in the same way, regardless of whether or not the scanmakes use of parallelism.Oversight in commit5bf748b, which enhanced nbtree ScalarArrayOpexecution.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Tomas Vondra <tomas@vondra.me>Discussion:https://postgr.es/m/CAH2-Wz=E7XrkvscBN0U6V81NK3Q-dQOmivvbEsjG-zwEfDdFpg@mail.gmail.comDiscussion:https://postgr.es/m/CAH2-WzkRqvaqR2CTNqTZP0z6FuL4-3ED6eQB0yx38XBNj1v-4Q@mail.gmail.comBackpatch: 17-, where nbtree SAOP execution was enhanced.1 parentd35e293 commitc00c54a
1 file changed
+6
-2
lines changedLines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
896 | 896 |
| |
897 | 897 |
| |
898 | 898 |
| |
899 |
| - | |
900 |
| - | |
901 | 899 |
| |
902 | 900 |
| |
903 | 901 |
| |
| |||
960 | 958 |
| |
961 | 959 |
| |
962 | 960 |
| |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
963 | 967 |
| |
964 | 968 |
| |
965 | 969 |
| |
|
0 commit comments
Comments
(0)