doc-exports/docs/ddm/umn/ddm_03_0062.html
Ru, Li Yi 4b09a03a51 ddm_umn
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>
2024-04-11 11:39:26 +00:00

80 lines
11 KiB
HTML

<a name="ddm_03_0062"></a><a name="ddm_03_0062"></a>
<h1 class="topictitle1">Introduction</h1>
<div id="body1597045078513"><p id="ddm_03_0062__p466232353417">DDM is compatible with the MySQL license and syntax, but the use of SQL statements is limited due to differences between distributed databases and single-node databases.</p>
<p id="ddm_03_0062__p1484618164531">Before selecting a DDM solution, evaluate the SQL syntax compatibility between your application and DDM.</p>
<div class="section" id="ddm_03_0062__section376461485620"><h4 class="sectiontitle">MySQL EXPLAIN</h4><p id="ddm_03_0062__p571313169568">If you add <strong id="ddm_03_0062__b1842811531234">EXPLAIN</strong> before a SQL statement, you will see a specific execution plan when you execute the statement. You can analyze the time required based on the plan and modify the SQL statement for optimization.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ddm_03_0062__table13151163214918" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Description of the <strong id="ddm_03_0062__b95198550310">EXPLAIN</strong> column</caption><thead align="left"><tr id="ddm_03_0062__row1515113324912"><th align="left" class="cellrowborder" valign="top" width="14.649999999999999%" id="mcps1.3.3.3.2.3.1.1"><p id="ddm_03_0062__p20151832096"><strong id="ddm_03_0062__b2086895618311">Column Name</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="85.35000000000001%" id="mcps1.3.3.3.2.3.1.2"><p id="ddm_03_0062__p15152103217911"><strong id="ddm_03_0062__b166361094158">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="ddm_03_0062__row81525321396"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p1515223218911">table</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p151528321193">Table that the row of data belongs to</p>
</td>
</tr>
<tr id="ddm_03_0062__row11152183216917"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p41521232599">type</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p13152103210919">Type of the connection. Connection types from the best to the worst are <strong id="ddm_03_0062__b2911146101616">const</strong>, <strong id="ddm_03_0062__b13912196121619">eq_reg</strong>, <strong id="ddm_03_0062__b1912166101612">ref</strong>, <strong id="ddm_03_0062__b791313610168">range</strong>, <strong id="ddm_03_0062__b19146616161">index</strong>, and <strong id="ddm_03_0062__b09144641619">ALL</strong>.</p>
</td>
</tr>
<tr id="ddm_03_0062__row3152132194"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p13152113214918">possible_keys</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p11152932297">Index that may be applied to the table</p>
</td>
</tr>
<tr id="ddm_03_0062__row191526321898"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p151521232894">key</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p01525321895">Index that is actually used. If the value is <strong id="ddm_03_0062__b7640162013163">NULL</strong>, no index is used. In some cases, MySQL may choose to optimize indexes, for example, force MySQL to use an index by adding <strong id="ddm_03_0062__b78061523171616">USE INDEX(indexname)</strong> to a SELECT statement or to ignore an index by adding <strong id="ddm_03_0062__b12807102318163">IGNORE INDEX(indexname)</strong>.</p>
</td>
</tr>
<tr id="ddm_03_0062__row18152532796"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p11152932992">key_len</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p5152123210917">Length of the used index. The shorter the length is, the better the index is if accuracy is not affected.</p>
</td>
</tr>
<tr id="ddm_03_0062__row91528321390"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p915214321991">ref</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p1615213213915">Column where the index is used. The value is generally a constant.</p>
</td>
</tr>
<tr id="ddm_03_0062__row161521932397"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p31524322096">rows</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p141521232494">Rows of the data returned by MySQL</p>
</td>
</tr>
<tr id="ddm_03_0062__row15152732192"><td class="cellrowborder" valign="top" width="14.649999999999999%" headers="mcps1.3.3.3.2.3.1.1 "><p id="ddm_03_0062__p121527321395">Extra</p>
</td>
<td class="cellrowborder" valign="top" width="85.35000000000001%" headers="mcps1.3.3.3.2.3.1.2 "><p id="ddm_03_0062__p11524328918">Additional information about how MySQL parses queries</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="ddm_03_0062__section1584475411502"><h4 class="sectiontitle">SQL Restrictions</h4><ul id="ddm_03_0062__ul4504619185110"><li id="ddm_03_0062__li1850415192519">Temporary tables are not supported.</li></ul>
</div>
<ul id="ddm_03_0062__ul116552355348"><li id="ddm_03_0062__li1565517356343">Foreign keys, views, cursors, triggers, and stored procedures are not supported.</li><li id="ddm_03_0062__li19266105312424">Customized data types and functions are not supported.</li><li id="ddm_03_0062__li134478974316">Process control statements such as IF and WHILE are not supported.</li><li id="ddm_03_0062__li3655173515344">Compound statements such as BEGIN...END, LOOP...END LOOP, REPEAT...UNTIL...END REPEAT, and WHILE...DO...END WHILE are not supported.</li></ul>
<div class="section" id="ddm_03_0062__section3671119104313"><h4 class="sectiontitle">DDL Syntax</h4><ul id="ddm_03_0062__ubb8b407e553b4a579ef4856ccdcee810"><li id="ddm_03_0062__li9885141212612">Sharded and broadcast tables do not support foreign keys.</li><li id="ddm_03_0062__li11930611719">Modifying sharding keys is not supported.</li><li id="ddm_03_0062__laf88c345bcff47efaab1f04a4fe0da92">ALTER DATABASE Syntax is not supported.</li><li class="msonormal" id="ddm_03_0062__la1d19694f4d24f60b75c6c34f2e2cd55">Creating sharded or broadcast tables from another table is not supported.</li><li id="ddm_03_0062__li13836141831319">The CREATE TABLE statement does not support GENERATED COLUMN.</li><li id="ddm_03_0062__li155368010181">Modifying sharding keys or global sequence fields using the <strong id="ddm_03_0062__b532816469448">ALTER</strong> command is not supported.</li><li class="msonormal" id="ddm_03_0062__li175141955141420">Creating TEMPORARY sharded or broadcast tables is not supported.</li><li id="ddm_03_0062__li172637311818">The logical table name contains only letters, digits, and underscores (_).</li><li class="msonormal" id="ddm_03_0062__li20391858101418">CREATE TABLE tbl_name LIKE old_tbl_name is not supported.</li><li class="msonormal" id="ddm_03_0062__l75cd0453b01947009149d65a93b54ac0">The CREATE TABLE tbl_name SELECT statement is not supported.</li><li id="ddm_03_0062__li15967193831118">Updating the sharding key by executing INSERT INTO ON DUPLICATE KEY UPDATE is not supported.</li><li id="ddm_03_0062__li435082610128">Cross-schema DDL is not supported, for example, CREATE TABLE db_name.tbl_name (... )</li><li id="ddm_03_0062__li341764035213">Reverse quotation marks are required to quote identifiers such as table names, column names, and index names that are MySQL key words or reserved words.</li></ul>
</div>
<div class="section" id="ddm_03_0062__section2095717195442"><h4 class="sectiontitle">DML Syntax</h4><ul id="ddm_03_0062__ul75317362208"><li id="ddm_03_0062__li107191913593">PARTITION clauses are not supported.</li><li id="ddm_03_0062__li45001442102019">Nesting a subquery in an UPDATE statement is not supported.</li><li id="ddm_03_0062__li8590433191814">INSERT DELAYED Syntax is not supported.</li><li id="ddm_03_0062__li1359011339189">STRAIGHT_JOIN and NATURAL JOIN are not supported.</li><li id="ddm_03_0062__li740111263207">Multiple-table UPDATE is supported if all tables joined across shards have primary keys.</li><li id="ddm_03_0062__li5183511202111">Multiple-table DELETE is supported if all tables joined across shards have primary keys.</li></ul>
<ul id="ddm_03_0062__ul8845671256"><li id="ddm_03_0062__li1759083341819">Using or manipulating variables in SQL statements is not supported, for example, SET @c=1, @d=@c+1; SELECT @c, @d.</li><li id="ddm_03_0062__li155231158304">Inserting keyword DEFAULT or updating a sharding key value to DEFAULT is not supported.</li><li id="ddm_03_0062__li190715494419">Repeatedly updating the same field in an UPDATE statement is not supported.</li><li id="ddm_03_0062__li1315217103456">Updating a sharding key using UPDATE JOIN syntax is not supported.</li><li id="ddm_03_0062__li42721236546">UPDATE cannot be used to update self-joins.</li><li id="ddm_03_0062__li19551013286">Referencing other object columns in assignment statements or expressions may cause unexpected update results. Example:<p id="ddm_03_0062__p18887153252820"><a name="ddm_03_0062__li19551013286"></a><a name="li19551013286"></a>update tbl_1 a,tbl_2 b set a.name=concat(b.name,'aaaa'),b.name=concat(a.name,'bbbb') on a.id=b.id</p>
</li><li id="ddm_03_0062__li1586416254205">If a text protocol is used, BINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB data must be converted into hexadecimal data.</li><li id="ddm_03_0062__li13169163411207">DDM processes invalid data based on <strong id="ddm_03_0062__b399016310141">sql_mode</strong> settings of associated MySQL instances.</li><li id="ddm_03_0062__li149961822104518">UPDATE JOIN supports only joins with WHERE conditions.</li><li id="ddm_03_0062__li1649124875615">The expression in a SQL statement has a maximum of 1000 factors.</li></ul>
</div>
<div class="section" id="ddm_03_0062__section96852211313"><h4 class="sectiontitle">Unsupported Functions</h4><ul id="ddm_03_0062__ul512673072513"><li id="ddm_03_0062__li16126730202510">XML functions</li><li id="ddm_03_0062__li101261530142516">GTID functions</li><li id="ddm_03_0062__li412603002513">Full-text search functions</li><li id="ddm_03_0062__li812612304257">Enterprise encryption functions</li><li id="ddm_03_0062__li512603019257">Function <strong id="ddm_03_0062__b123616325168">row_count()</strong></li></ul>
</div>
<div class="section" id="ddm_03_0062__section106588455292"><h4 class="sectiontitle">Subqueries</h4><p id="ddm_03_0062__p15432433202918">Using subqueries in the HAVING clause and the JOIN ON condition is not supported.</p>
</div>
<div class="section" id="ddm_03_0062__section233294763119"><h4 class="sectiontitle">Data Types</h4><p id="ddm_03_0062__p88191848103115">Spatial data types are not supported.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="ddm_08_0001.html">SQL Syntax</a></div>
</div>
</div>