forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
37 lines
13 KiB
HTML
37 lines
13 KiB
HTML
<a name="EN-US_TOPIC_0000001233563143"></a><a name="EN-US_TOPIC_0000001233563143"></a>
|
|
|
|
<h1 class="topictitle1">Hint Errors, Conflicts, and Other Warnings</h1>
|
|
<div id="body1534471018690"><p id="EN-US_TOPIC_0000001233563143__p12766133819328">Plan hints change an execution plan. You can run <strong id="EN-US_TOPIC_0000001233563143__b184351781581">EXPLAIN</strong> to view the changes.</p>
|
|
<p id="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_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_0000001233563143__b1765654410158">PLANHINT</strong> keyword.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001233563143__section324915591461"><h4 class="sectiontitle">Hint Error Types</h4><ul id="EN-US_TOPIC_0000001233563143__ul1942963044717"><li id="EN-US_TOPIC_0000001233563143__li164298309473">Syntax errors.<p class="litext" id="EN-US_TOPIC_0000001233563143__p16360191514202"><a name="EN-US_TOPIC_0000001233563143__li164298309473"></a><a name="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_0000001233563143__p79295064920">For example, the hint keyword is incorrect, no table or only one table is specified in the <strong id="EN-US_TOPIC_0000001233563143__b14511718519">leading</strong> or <strong id="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_0000001233563143__p3929204491">For example:</p>
|
|
<div class="codecoloring" codetype="Sql" id="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_0000001233563143__p4929120184910">The syntax of <strong id="EN-US_TOPIC_0000001233563143__b157091045153312">nestloop(t1)</strong> is wrong and its parsing is terminated. Only <strong id="EN-US_TOPIC_0000001233563143__b660616309341">leading(t1 t2)</strong> that has been successfully parsed before <strong id="EN-US_TOPIC_0000001233563143__b136191317123614">nestloop(t1)</strong> is valid.</p>
|
|
</li><li id="EN-US_TOPIC_0000001233563143__li17463135184710">Semantic errors.<ul id="EN-US_TOPIC_0000001233563143__ul1632163651611"><li class="litext" id="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_0000001233563143__b169361251193915">leading</strong> or <strong id="EN-US_TOPIC_0000001233563143__b533155563915">join</strong> hint.</li><li class="litext" id="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_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_0000001233563143__li78381044154718">Duplicated or conflicted hints.<p class="litext" id="EN-US_TOPIC_0000001233563143__p61711154152019"><a name="EN-US_TOPIC_0000001233563143__li78381044154718"></a><a name="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_0000001233563143__ul13697155141712"><li class="litext" id="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_0000001233563143__b1356005216545">nestloop(t1 t2) nestloop(t1 t2)</strong>.</li><li class="litext" id="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_0000001233563143__p117111318142112"><a name="EN-US_TOPIC_0000001233563143__li2073741717210"></a><a name="li2073741717210"></a>For example, if <strong id="EN-US_TOPIC_0000001233563143__b133496361730">nestloop (t1 t2) hashjoin (t1 t2)</strong> is used, <strong id="EN-US_TOPIC_0000001233563143__b1166942410">hashjoin (t1 t2)</strong> becomes invalid. <strong id="EN-US_TOPIC_0000001233563143__b853320539414">nestloop(t1 t2)</strong> does not conflict with <strong id="EN-US_TOPIC_0000001233563143__b196091131554">no mergejoin(t1 t2)</strong>.<div class="notice" id="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_0000001233563143__p18796154441713">The table list in the <strong id="EN-US_TOPIC_0000001233563143__b1424110105255">leading</strong> hint is disassembled. For example, <strong id="EN-US_TOPIC_0000001233563143__b79456252253">leading (t1 t2 t3)</strong> will be disassembled as <strong id="EN-US_TOPIC_0000001233563143__b611411442710">leading(t1 t2) leading((t1 t2) t3)</strong>, which will conflict with <strong id="EN-US_TOPIC_0000001233563143__b14669256132711">leading(t2 t1)</strong> (if any). In this case, the latter <strong id="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_0000001233563143__li23716011485">A hint becomes invalid after a sublink is pulled up.<p id="EN-US_TOPIC_0000001233563143__p9923184714915"><a name="EN-US_TOPIC_0000001233563143__li23716011485"></a><a name="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_0000001233563143__li132222062914">Unsupported column types.<ul id="EN-US_TOPIC_0000001233563143__ul632202018298"><li id="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_0000001233563143__li79497816481">Specified hints are not used.<ul id="EN-US_TOPIC_0000001233563143__ul0595185595016"><li id="EN-US_TOPIC_0000001233563143__li13500852135017">If <strong id="EN-US_TOPIC_0000001233563143__b1431753185210">hashjoin</strong> or <strong id="EN-US_TOPIC_0000001233563143__b168636185319">mergejoin</strong> is specified for non-equivalent joins, it will not be used.</li><li id="EN-US_TOPIC_0000001233563143__li15012052175010">If <strong id="EN-US_TOPIC_0000001233563143__b241111124519">indexscan</strong> or<strong id="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_0000001233563143__li75011552125019">If <strong id="EN-US_TOPIC_0000001233563143__b377239114712">indexscan hint</strong> or <strong id="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_0000001233563143__li205021252175014">The specified <strong id="EN-US_TOPIC_0000001233563143__b72653403020">indexonlyscan</strong> hint is used only when the output column contains only indexes.</li><li id="EN-US_TOPIC_0000001233563143__li17502135225015">In equivalent joins, only the joins containing equivalence conditions are valid. Therefore, the <strong id="EN-US_TOPIC_0000001233563143__b856411369517">leading</strong>, <strong id="EN-US_TOPIC_0000001233563143__b17211039556">join</strong>, and <strong id="EN-US_TOPIC_0000001233563143__b1441715428514">rows</strong> hints specified for the joins without an equivalence condition will not be used. For example, <strong id="EN-US_TOPIC_0000001233563143__b1361711236716">t1</strong>, <strong id="EN-US_TOPIC_0000001233563143__b757833310710">t2</strong>, and <strong id="EN-US_TOPIC_0000001233563143__b4650184114719">t3</strong> are to be joined, and the join between <strong id="EN-US_TOPIC_0000001233563143__b13451242191618">t1</strong> and <strong id="EN-US_TOPIC_0000001233563143__b1499424471620">t3</strong> does not contain an equivalence condition. In this case, <strong id="EN-US_TOPIC_0000001233563143__b1488443571115">leading(t1 t3)</strong> will not be used.</li><li id="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_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_0000001233563143__b12632141624917">redistribute</strong> specified for this table will be used but <strong id="EN-US_TOPIC_0000001233563143__b1290733002414">broadcast</strong> will not.</li><li id="EN-US_TOPIC_0000001233563143__li1668338193114">If a hint for an <strong id="EN-US_TOPIC_0000001233563143__b114391500582">Agg</strong> distribution column is not used, the possible causes are as follows:<ul id="EN-US_TOPIC_0000001233563143__ul56978337318"><li id="EN-US_TOPIC_0000001233563143__li1169783353113">The specified distribution key contains data types that do not support redistribution.</li><li id="EN-US_TOPIC_0000001233563143__li1821004893118">Redistribution is not required in the execution plan.</li><li id="EN-US_TOPIC_0000001233563143__li87045410315">Wrong distribution key sequence numbers are executed.</li><li id="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_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_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_0000001233563143__li4503452115020">If no sublink is pulled up, the specified <strong id="EN-US_TOPIC_0000001233563143__b15607836185019">blockname</strong> hint will not be used.</li><li id="EN-US_TOPIC_0000001233563143__li10275185905217">For unused skew hints, the possible causes are:<ul id="EN-US_TOPIC_0000001233563143__ul12391415195312"><li id="EN-US_TOPIC_0000001233563143__li1618716115533">The plan does not require redistribution.</li><li id="EN-US_TOPIC_0000001233563143__li1354119213539">The columns specified by hints contain distribution keys.</li><li id="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_0000001233563143__li35031840103410">Skew optimization is disabled by GUC parameters.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001233563143__li197131848155919">For unused guc hints, the possible causes are:<ul id="EN-US_TOPIC_0000001233563143__ul1994185179"><li id="EN-US_TOPIC_0000001233563143__li2602321073">The configuration parameter does not exist.</li><li id="EN-US_TOPIC_0000001233563143__li15683113210711">The configuration parameter is not supported by GUC hints.</li><li id="EN-US_TOPIC_0000001233563143__li181641886916">The configuration parameter value is invalid.</li><li id="EN-US_TOPIC_0000001233563143__li196403443172">The statement-level GUC hint is not written in the top-level query.</li><li id="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_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>
|
|
|