Files
doc-exports/docs/dws/dev/dws_04_0464.html
luhuayi 177cd61a57 DWS DEVG 910.211 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: luhuayi <luhuayi@huawei.com>
Co-committed-by: luhuayi <luhuayi@huawei.com>
2025-05-05 07:44:03 +00:00

36 lines
16 KiB
HTML

<a name="EN-US_TOPIC_0000002088734305"></a><a name="EN-US_TOPIC_0000002088734305"></a>
<h1 class="topictitle1">Hint Errors, Conflicts, and Other Warnings</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p12766133819328">Plan hints change an execution plan. You can run <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b184351781581">EXPLAIN</strong> to view the changes.</p>
<p id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p678775420343">Hints containing errors are invalid and do not affect statement execution. The errors will be displayed in different ways based on statement types. Hint errors in an <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b159244018131">EXPLAIN</strong> statement are displayed as a warning on the interface. Hint errors in other statements will be recorded in debug1-level logs containing the <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1765654410158">PLANHINT</strong> keyword.</p>
<div class="section" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_section324915591461"><h4 class="sectiontitle">Hint Error Types</h4><ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul1942963044717"><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li164298309473">Syntax errors.<p class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p16360191514202"><a name="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li164298309473"></a><a name="en-us_topic_0000001233563143_li164298309473"></a>An error will be reported if the syntax tree fails to be reduced. The No. of the row generating an error is displayed in the error details.</p>
<p class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p79295064920">For example, the hint keyword is incorrect, no table or only one table is specified in the <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b14511718519">leading</strong> or <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b159331441519">join</strong> hint, or no tables are specified in other hints. The parsing of a hint is terminated immediately after a syntax error is detected. Only the hints that have been parsed successfully are valid.</p>
<p id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p3929204491">For example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_screen11219148111211"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">leading</span><span class="p">((</span><span class="n">t1</span><span class="w"> </span><span class="n">t2</span><span class="p">))</span><span class="w"> </span><span class="n">nestloop</span><span class="p">(</span><span class="n">t1</span><span class="p">)</span><span class="w"> </span><span class="k">rows</span><span class="p">(</span><span class="n">t1</span><span class="w"> </span><span class="n">t2</span><span class="w"> </span><span class="o">#</span><span class="mi">10</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p4929120184910">The syntax of <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b157091045153312">nestloop(t1)</strong> is wrong and its parsing is terminated. Only <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b660616309341">leading(t1 t2)</strong> that has been successfully parsed before <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b136191317123614">nestloop(t1)</strong> is valid.</p>
</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li17463135184710">Semantic errors.<ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul1632163651611"><li class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li892173219164">An error will be reported if the specified tables do not exist, multiple tables are found based on the hint setting, or a table is used more than once in the <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b169361251193915">leading</strong> or <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b533155563915">join</strong> hint.</li><li class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li89221232171610">An error will be reported if the index specified in a scan hint does not exist.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li292293213167">If multiple tables with the same name exist after a subquery is pulled up and some of them need to be hinted, add aliases for them to avoid name duplication.</li></ul>
</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li78381044154718">Duplicated or conflicted hints.<p class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p61711154152019"><a name="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li78381044154718"></a><a name="en-us_topic_0000001233563143_li78381044154718"></a>If hint duplication or conflicts occur, only the first hint takes effect. A message will be displayed to describe the situation.</p>
<ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul13697155141712"><li class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li547212214175">Hint duplication indicates that a hint is used more than once in the same query, for example, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1356005216545">nestloop(t1 t2) nestloop(t1 t2)</strong>.</li><li class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li2073741717210">A hint conflict indicates that the functions of two hints with the same table list conflict with each other.<div class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p117111318142112"><a name="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li2073741717210"></a><a name="en-us_topic_0000001233563143_li2073741717210"></a>For example, if <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b133496361730">nestloop (t1 t2) hashjoin (t1 t2)</strong> is used, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1166942410">hashjoin (t1 t2)</strong> becomes invalid. <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b853320539414">nestloop(t1 t2)</strong> does not conflict with <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b196091131554">no mergejoin(t1 t2)</strong>.<div class="notice" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_note287285719176"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p class="litext" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p18796154441713">The table list in the <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1424110105255">leading</strong> hint is disassembled. For example, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b79456252253">leading (t1 t2 t3)</strong> will be disassembled as <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b611411442710">leading(t1 t2) leading((t1 t2) t3)</strong>, which will conflict with <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b14669256132711">leading(t2 t1)</strong> (if any). In this case, the latter <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b5129165120288">leading(t2 t1)</strong> becomes invalid. If two hints use duplicated table lists and only one of them has the specified outer/inner table, the one without a specified outer/inner table becomes invalid.</p>
</div></div>
</div>
</li></ul>
</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li23716011485">A hint becomes invalid after a sublink is pulled up.<p id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p9923184714915"><a name="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li23716011485"></a><a name="en-us_topic_0000001233563143_li23716011485"></a>In this case, a message will be displayed. Generally, such invalidation occurs if a sublink contains multiple tables to be joined, because the table list in the sublink becomes invalid after the sublink is pulled up.</p>
</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li132222062914">Unsupported column types.<ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul632202018298"><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li3322620152919">Skew hints are specified to optimize redistribution. They will be invalid if their corresponding columns do not support redistribution.</li></ul>
</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li79497816481">Specified hints are not used.<ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul0595185595016"><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li13500852135017">If <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1431753185210">hashjoin</strong> or <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b168636185319">mergejoin</strong> is specified for non-equivalent joins, it will not be used.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li15012052175010">If <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b241111124519">indexscan</strong> or<strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b8858913164510"> indexonlyscan</strong> is specified for a table that does not have an index, it will not be used.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li75011552125019">If <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b377239114712">indexscan hint</strong> or <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1882901834711">indexonlyscan</strong> is specified for a full-table scan or for a scan whose filtering conditions are not set on index columns, it will not be used.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li205021252175014">The specified <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b72653403020">indexonlyscan</strong> hint is used only when the output column contains only indexes.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li17502135225015">In equivalent joins, only the joins containing equivalence conditions are valid. Therefore, the <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b068111276543">leading</strong>, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b14681112718545">join</strong>, and <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b146828278543">rows</strong> hints specified for the joins without an equivalence condition will not be used. For example, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b17682102718542">t1</strong>, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b166821027135418">t2</strong>, and <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b7682102716549">t3</strong> are to be joined, and the join between <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b3683142716543">t1</strong> and <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1568314276541">t3</strong> does not contain an equivalence condition. In this case, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b146838274545">leading(t1 t3)</strong> will not be used.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li1250385219507">To generate a streaming plan, if the distribution key of a table is the same as its join key, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b461624632216">redistribute</strong> specified for this table will not be used. If the distribution key and join key are different for this table but the same for the other table in the join, <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b12632141624917">redistribute</strong> specified for this table will be used but <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b1290733002414">broadcast</strong> will not.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li1668338193114">If a hint for an <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b114391500582">Agg</strong> distribution column is not used, the possible causes are as follows:<ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul56978337318"><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li1169783353113">The specified distribution key contains data types that do not support redistribution.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li1821004893118">Redistribution is not required in the execution plan.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li87045410315">Wrong distribution key sequence numbers are executed.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li12635105153512">For AP functions that use the GROUPING SETS and CUBE clauses, hints are not supported for distribution keys in window aggregate functions .<div class="note" id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_note1490818191354"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_p139081919751">Specifies the hint for the distribution column druing the Agg process.. This parameter is supported only by clusters of version 8.1.3.100 or later.</p>
</div></div>
</li></ul>
</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li4503452115020">If no sublink is pulled up, the specified <strong id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_b15607836185019">blockname</strong> hint will not be used.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li10275185905217">For unused skew hints, the possible causes are:<ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul12391415195312"><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li1618716115533">The plan does not require redistribution.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li1354119213539">The columns specified by hints contain distribution keys.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li197065575311">Skew information specified in hints is incorrect or incomplete, for example, no value is specified for join optimization.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li35031840103410">Skew optimization is disabled by GUC parameters.</li></ul>
</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li197131848155919">For unused guc hints, the possible causes are:<ul id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_ul1994185179"><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li2602321073">The configuration parameter does not exist.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li15683113210711">The configuration parameter is not supported by GUC hints.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li181641886916">The configuration parameter value is invalid.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li196403443172">The statement-level GUC hint is not written in the top-level query.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li1922195361816">The configuration parameter set by the GUC hint at the subquery level cannot be set at the subquery level.</li><li id="EN-US_TOPIC_0000002088734305__en-us_topic_0000001233563143_li984516117206">The subquery where the GUC hint is located is pulled up.</li></ul>
</li></ul>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0454.html">Hint-based Tuning</a></div>
</div>
</div>