Re: Showing primitive index scan count in EXPLAIN ANALYZE (for skip scan and SAOP scans)
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-23T18:16:09Z
Lists: pgsql-hackers
On Wed, Jul 23, 2025 at 1:50 PM Andres Freund <andres@anarazel.de> wrote: > A minor question about this patch: Was there a particular reason it added the > index specific instrumentation information inline in IndexScanState etc? Of > course the amount of memory right now is rather trivial, so that is not an > issue memory usage wise. Is that the reason? There was no very good reason behind my choice to do things that way. I wanted to minimize the amount of churn in files like nodeIndexScan.c. It was almost an arbitrary choice. > The background for my question is that I was looking at what it would take to > track the index and table buffer usage separately for > IndexScanState/IndexOnlyScanState and IndexScanInstrumentation seems to be > pre-destined for that information. But it seems a a bit too much memory to > just keep a BufferUsage around even when analyze isn't used. Offhand, I'd say that it would almost certainly be okay to switch over to using dynamic allocation for IndexScanInstrumentation, instead of storing it inline in IndexScanState/IndexOnlyScanState. That way you could add many more fields to IndexScanInstrumentation, without that creating any memory bloat problems in the common case where the scan isn't running in an EXPLAIN ANALYZE. -- Peter Geoghegan
Commits
-
Show index search count in EXPLAIN ANALYZE, take 2.
- 0fbceae841cb 18.0 landed
-
Show index search count in EXPLAIN ANALYZE.
- 5ead85fbc811 18.0 landed
-
Allow usage of match_orclause_to_indexcol() for joins
- 627d63419e22 18.0 cited
-
Fix nbtree pgstats accounting with parallel scans.
- c00c54a9ac1e 18.0 landed
- fb4f5e58af97 17.0 landed
-
Enhance nbtree ScalarArrayOp execution.
- 5bf748b86bc6 17.0 cited
-
Fix EXPLAIN ANALYZE of hash join when the leader doesn't participate.
- 5bcf389ecfd4 11.0 cited