under HASH_STATISTICS, the output reporting "this HTAB" upon destruction is
pretty useless. Which HTAB would this one be?  It is not necessarily the
most recently created one.

This makes it output the %p to the actual HTAB, so it can be matched up
with the logging of the creation.

I'm not sure why it bypasses elog.  Is that so it can run during start-up
before elog is active?  I'd like to make it go through elog so that
log_line_prefix are applied, but then it would no longer be a trivial patch.

Cheers,

Jeff
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
new file mode 100644
index 2b99e4b..89c3a9d
*** a/src/backend/utils/hash/dynahash.c
--- b/src/backend/utils/hash/dynahash.c
*************** void
*** 733,740 ****
  hash_stats(const char *where, HTAB *hashp)
  {
  #if HASH_STATISTICS
! 	fprintf(stderr, "%s: this HTAB -- accesses %ld collisions %ld\n",
! 			where, hashp->hctl->accesses, hashp->hctl->collisions);
  
  	fprintf(stderr, "hash_stats: entries %ld keysize %ld maxp %u segmentcount %ld\n",
  			hashp->hctl->nentries, (long) hashp->hctl->keysize,
--- 737,744 ----
  hash_stats(const char *where, HTAB *hashp)
  {
  #if HASH_STATISTICS
! 	fprintf(stderr, "%s: HTAB %p -- accesses %ld collisions %ld\n",
! 			where, hashp, hashp->hctl->accesses, hashp->hctl->collisions);
  
  	fprintf(stderr, "hash_stats: entries %ld keysize %ld maxp %u segmentcount %ld\n",
  			hashp->hctl->nentries, (long) hashp->hctl->keysize,
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to