Hi hackers! I was asked to prototype a feature that helps to distinguish shared buffer usage between index reads and heap reads. Practically it looks like this:
# explain (analyze,verbose,buffers) select nextval('s'); QUERY PLAN ------------------------------------------------------------------------------------------------ Result (cost=0.00..0.01 rows=1 width=8) (actual time=1.159..1.160 rows=1 loops=1) Output: nextval('s'::regclass) Buffers: shared hit=7(relation 3, index 4) read=6(relation 1, index 4, sequence 1) dirtied=1 Planning Time: 0.214 ms Execution Time: 1.238 ms (5 rows) The change is in these parts "(relation 3, index 4)" and "(relation 1, index 4, sequence 1)". Probably, it should help DBAs to better understand complex queries. I think cluttering output with more text is OK as long as "verbose" is requested. But there are some caveats: 1. Some more increments on hot paths. We have to add this tiny toll to every single buffer hit, but it will be seldom of any use. 2. It's difficult to measure writes caused by query, and even dirties. The patch adds "evictions" caused by query, but they have little practical sense too. All in all I do not have an opinion if this feature is a good tradeoff. What do you think? Does the feature look useful? Do we want a more polished implementation? Thanks! Best regards, Andrey Borodin.
v1-0001-Split-EXPLAIN-ANALYZE-BUFFERS-by-RelKind.patch
Description: Binary data