Describe the bug
The buffers read by worker processes are not reported in the parallel nodes. They appear only in the coordinator’s total giving the impression it is that node that reads those pages.
To Reproduce
- Connect to the public database https://rnacentral.org/help/public-database
- Visualize the query plan for:
SELECT
upi,
taxid,
short_description AS description,
len AS sequence_length,
rna_type
FROM rna
JOIN rnc_rna_precomputed USING (upi)
WHERE taxid = 9606 -- Homo sapiens
AND rna_type = 'miRNA'
ORDER BY sequence_length DESC
LIMIT 20;
The graphs show 112K buffers for Gather Merge but only 36K under it:
The explain from psql shows 112K for the nodes below:
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual time=44.815..46.013 rows=20 loops=1)
Buffers: shared hit=112582
-> Gather Merge (actual time=44.813..46.009 rows=20 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=112582
-> Sort (actual time=41.270..41.272 rows=17 loops=3)
Sort Key: rna.len DESC
Sort Method: top-N heapsort Memory: 28kB
Buffers: shared hit=112582
Worker 0: Sort Method: top-N heapsort Memory: 28kB
Worker 1: Sort Method: top-N heapsort Memory: 28kB
-> Nested Loop (actual time=0.683..40.930 rows=1313 loops=3)
Buffers: shared hit=112568
-> Parallel Index Scan using rnc_rna_precomputed_rna_type_idx on rnc_rna_precomputed (actual time=0.658..31.353 rows=1313 loops=3)
Index Cond: ((rna_type)::text = 'miRNA'::text)
Filter: (taxid = 9606)
Rows Removed by Filter: 99121
Buffers: shared hit=92876
-> Index Scan using rna_pkey on rna (actual time=0.007..0.007 rows=1 loops=3938)
Index Cond: ((upi)::text = (rnc_rna_precomputed.upi)::text)
Buffers: shared hit=19692
Planning:
Buffers: shared hit=24
(24 rows)
36K is one third, the coordinator without the two workers.
In the "Source View" the worker buffers are not in the array:
Workers:
[{"Worker Number":0,"Actual Startup Time":41.831,"Actual Total Time":41.834,"Actual Rows":20,"Actual Loops":1},{"Worker Number":1,"Actual Startup Time":41.619,"Actual Total Time":41.623,"Actual Rows":20,"Actual Loops":1}]
That's probably why they are not accounted.
Expected behavior
Show the sum of coordinator plus workers when it is a parallel node
Describe the bug
The buffers read by worker processes are not reported in the parallel nodes. They appear only in the coordinator’s total giving the impression it is that node that reads those pages.
To Reproduce
The graphs show 112K buffers for Gather Merge but only 36K under it:
The explain from psql shows 112K for the nodes below:
36K is one third, the coordinator without the two workers.
In the "Source View" the worker buffers are not in the array:
That's probably why they are not accounted.
Expected behavior
Show the sum of coordinator plus workers when it is a parallel node