• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

firtst release


Commit MetaInfo

Revisión0fe27602c9c1f41e066901c20800fdec6f9ac184 (tree)
Tiempo2020-10-29 21:12:16
AutorKyotaro Horiguchi <horikyoga.ntt@gmai...>
CommiterKyotaro Horiguchi

Log Message

Make HashJoin hint more coercive.

Even with HashJoin hint, hash joins may be rejected by planner if hash
table for the inner-rel is estimated too large. Make HashJoin hint
more coercive by temporarily increasing work_mem. This change affects
only join-searching so no significant side-effects are expected.

Cambiar Resumen

Diferencia incremental

--- a/pg_hint_plan.c
+++ b/pg_hint_plan.c
@@ -2770,6 +2770,25 @@ set_join_config_options(unsigned char enforce_mask, GucContext context)
27702770 SET_CONFIG_OPTION("enable_nestloop", ENABLE_NESTLOOP);
27712771 SET_CONFIG_OPTION("enable_mergejoin", ENABLE_MERGEJOIN);
27722772 SET_CONFIG_OPTION("enable_hashjoin", ENABLE_HASHJOIN);
2773+
2774+ /*
2775+ * Hash join may be rejected for the reason of estimated memory usage. Try
2776+ * getting rid of that limitation. This change on work_mem is reverted just
2777+ * after searching join path so no suginificant side-effects are expected.
2778+ */
2779+ if (enforce_mask == ENABLE_HASHJOIN)
2780+ {
2781+ char buf[32];
2782+
2783+ /* See final_cost_hashjoin(). */
2784+ if (work_mem < MAX_KILOBYTES)
2785+ {
2786+ snprintf(buf, sizeof(buf), UINT64_FORMAT, (uint64)MAX_KILOBYTES);
2787+ set_config_option_noerror("work_mem", buf,
2788+ context, PGC_S_SESSION, GUC_ACTION_SAVE,
2789+ true, ERROR);
2790+ }
2791+ }
27732792 }
27742793
27752794 /*