Allow parallel create index to accumulate buffer usage stats.
authorAmit Kapila <akapila@postgresql.org>
Thu, 9 Apr 2020 03:41:24 +0000 (09:11 +0530)
committerAmit Kapila <akapila@postgresql.org>
Thu, 9 Apr 2020 03:51:09 +0000 (09:21 +0530)
commit13823ad3b012cfaf986ee4dfbd60190ca07187f1
treebdb416c571e540951f46f07cc4fcac682f3c3082
parent41b4b2a7cffc3f437aa19751f2055a2918429d33
Allow parallel create index to accumulate buffer usage stats.

Currently, we don't account for buffer usage incurred by parallel workers
for parallel create index.  This commit allows each worker to record the
buffer usage stats and leader backend to accumulate that stats at the
end of the operation.  This will allow pg_stat_statements to display
correct buffer usage stats for (parallel) create index command.

Reported-by: Julien Rouhaud
Author: Sawada Masahiko
Reviewed-by: Dilip Kumar, Julien Rouhaud and Amit Kapila
Backpatch-through: 11, where this was introduced
Discussion: https://postgr.es/m/20200328151721.GB12854@nol
src/backend/access/nbtree/nbtsort.c