Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe11f84

Browse files
committed
Improve HJDEBUG code a bit.
Commit30d7ae3 introduced an HJDEBUGstanza that probably didn't compile at the time, and definitely doesn'tcompile now, because it refers to a nonexistent variable. It doesn't seemterribly useful anyway, so just get rid of it.While I'm fooling with it, use %z modifier instead of the obsolete hack ofcasting size_t to unsigned long, and include the HashJoinTable's address ineach printout so that it's possible to distinguish the activities ofmultiple hashjoins occurring in one query.Noted while trying to use HJDEBUG to investigate bug #13908. Back-patchto 9.5, because code that doesn't compile is certainly not very helpful.
1 parent392998b commitbe11f84

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

‎src/backend/executor/nodeHash.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,6 @@ ExecHashTableCreate(Hash *node, List *hashOperators, bool keepNulls)
267267
OidIsValid(node->skewTable),
268268
&nbuckets,&nbatch,&num_skew_mcvs);
269269

270-
#ifdefHJDEBUG
271-
printf("nbatch = %d, nbuckets = %d\n",nbatch,nbuckets);
272-
#endif
273-
274270
/* nbuckets must be a power of 2 */
275271
log2_nbuckets=my_log2(nbuckets);
276272
Assert(nbuckets== (1 <<log2_nbuckets));
@@ -311,6 +307,11 @@ ExecHashTableCreate(Hash *node, List *hashOperators, bool keepNulls)
311307
hashtable->spaceAllowed*SKEW_WORK_MEM_PERCENT /100;
312308
hashtable->chunks=NULL;
313309

310+
#ifdefHJDEBUG
311+
printf("Hashjoin %p: initial nbatch = %d, nbuckets = %d\n",
312+
hashtable,nbatch,nbuckets);
313+
#endif
314+
314315
/*
315316
* Get info about the hash functions to be used for each hash key. Also
316317
* remember whether the join operators are strict.
@@ -615,8 +616,8 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
615616
Assert(nbatch>1);
616617

617618
#ifdefHJDEBUG
618-
printf("Increasingnbatch to %d because space = %lu\n",
619-
nbatch, (unsigned long)hashtable->spaceUsed);
619+
printf("Hashjoin %p: increasingnbatch to %d because space = %zu\n",
620+
hashtable,nbatch,hashtable->spaceUsed);
620621
#endif
621622

622623
oldcxt=MemoryContextSwitchTo(hashtable->hashCxt);
@@ -731,8 +732,8 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
731732
}
732733

733734
#ifdefHJDEBUG
734-
printf("Freed %ld of %ld tuples, space now %lu\n",
735-
nfreed,ninmemory, (unsigned long)hashtable->spaceUsed);
735+
printf("Hashjoin %p: freed %ld of %ld tuples, space now %zu\n",
736+
hashtable,nfreed,ninmemory,hashtable->spaceUsed);
736737
#endif
737738

738739
/*
@@ -747,7 +748,8 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
747748
{
748749
hashtable->growEnabled= false;
749750
#ifdefHJDEBUG
750-
printf("Disabling further increase of nbatch\n");
751+
printf("Hashjoin %p: disabling further increase of nbatch\n",
752+
hashtable);
751753
#endif
752754
}
753755
}
@@ -767,8 +769,8 @@ ExecHashIncreaseNumBuckets(HashJoinTable hashtable)
767769
return;
768770

769771
#ifdefHJDEBUG
770-
printf("Increasing nbuckets %d => %d\n",
771-
hashtable->nbuckets,hashtable->nbuckets_optimal);
772+
printf("Hashjoin %p: increasing nbuckets %d => %d\n",
773+
hashtable,hashtable->nbuckets,hashtable->nbuckets_optimal);
772774
#endif
773775

774776
hashtable->nbuckets=hashtable->nbuckets_optimal;
@@ -814,11 +816,6 @@ ExecHashIncreaseNumBuckets(HashJoinTable hashtable)
814816
HJTUPLE_MINTUPLE(hashTuple)->t_len);
815817
}
816818
}
817-
818-
#ifdefHJDEBUG
819-
printf("Nbuckets increased to %d, average items per bucket %.1f\n",
820-
hashtable->nbuckets,batchTuples /hashtable->nbuckets);
821-
#endif
822819
}
823820

824821

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp