You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug #33521622: Allow developers to force certain subplans in the hypergraph join optimizer
Add a new debug option “subplan_tokens”.
If active, each access path gets a digest based on the subplan that it
represents. This can be used by developers to force a given subplan,
to investigate e.g. whether a given choice is actually faster in practice,
force-apply a plan from the old join optimizer (or at least the types of
subplans that are ever considered; e.g. aggregation through temporary
tables are not) into the hypergraph join optimizer (to see how it's costed),
or whether a given plan is even generated. If DEBUG contains
force_subplan_0x<token>, subplans with the given token are unconditionally
preferred over all others.
The token returned is “0x<digest>”, where <digest> is the first 64 bits
of the MD5 sum of this string:
desc1,desc2,...,[child1_desc:]0xchild1,[child2_desc:]0xchild2,<more children>
where desc1, desc2, etc. are the description lines given by EXPLAIN,
and 0xchild1 is the token for children. The normal way to generate such
tokens is to use SET DEBUG='+d,subplan_tokens' and look at the EXPLAIN
FORMAT=tree, but in a pinch, you can also write them by hand and use
md5sum or a similar tool.
Only the hypergraph join optimizer honors token preferences, but EXPLAIN
FORMAT=tree shows computed tokens for both optimizers.
Change-Id: Ieaf35698dba5a54529ae86c61ed236999b6a65f0
-> [0x383f9723be72015d] Table scan on t1 (cost=0.08..0.25 rows=3)
36
+
-> Hash
37
+
-> [0xedd60db81c76aaf5] Table scan on t2 (cost=0.08..0.25 rows=3)
38
+
39
+
To force this plan, use:
40
+
SET DEBUG='+d,subplan_tokens,force_subplan_0x9fe1924c5f48742c,force_subplan_0x90b6f02248424220,force_subplan_0x383f9723be72015d,force_subplan_0xedd60db81c76aaf5';
41
+
42
+
SET DEBUG='-d,subplan_tokens';
43
+
EXPLAIN FORMAT=tree SELECT * FROM t1 JOIN t1 AS t2 ON t1.a=t2.a ORDER BY t1.a;
0 commit comments