forked from docs/doc-exports
Reviewed-by: Wagner, Fabian <fabian.wagner@t-systems.com> Co-authored-by: Ru, Li Yi <liyiru7@huawei.com> Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
21 lines
2.0 KiB
HTML
21 lines
2.0 KiB
HTML
<a name="ddm_03_0034"></a><a name="ddm_03_0034"></a>
|
|
|
|
<h1 class="topictitle1">Customized Hints for Read/Write Splitting</h1>
|
|
<div id="body1597045080515"><p id="ddm_03_0034__p662245454213">DDM allows you to customize a hint to specify whether SQL statements are executed on the primary instance or its read replicas.</p>
|
|
<p id="ddm_03_0034__p2193156183516">The following hint formats are supported:</p>
|
|
<p id="ddm_03_0034__p203772122306">Format 1</p>
|
|
<pre class="codeblock" id="ddm_03_0034__codeblock9304104813012">/*!mycat:db_type=<strong id="ddm_03_0034__b730654823012">hos</strong>t*/</pre>
|
|
<p id="ddm_03_0034__p16189123113011">Format 2</p>
|
|
<pre class="codeblock" id="ddm_03_0034__codeblock1158195419301">/*+ db_type=<strong id="ddm_03_0034__b18581954123019">host</strong> */</pre>
|
|
<p id="ddm_03_0034__p117631811102314"><strong id="ddm_03_0034__b842352706171941">host</strong> can be <strong id="ddm_03_0034__b28701374572">master</strong> or <strong id="ddm_03_0034__b1115044065716">slave</strong>. <strong id="ddm_03_0034__b1443215224573">master</strong> indicates a primary instance, and <strong id="ddm_03_0034__b11462190175817">slave</strong> indicates a read replica.</p>
|
|
<div class="p" id="ddm_03_0034__p362395414210">Currently, this function only applies to SELECT statements.<div class="note" id="ddm_03_0034__en-us_topic_0077295700_note395042155"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="ddm_03_0034__en-us_topic_0077295700_p095015212510">After read/write splitting is enabled, write operations are performed only on the primary instance, and read operations are performed only on its read replicas. To read from the primary instance, you can customize a hint to forcibly perform read operations on the primary instance. This method is only suitable for queries.</p>
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="ddm_08_0002.html">Supported SQL Statements</a></div>
|
|
</div>
|
|
</div>
|
|
|