Project: ShardingSphere (App Definition and Development / Database)
File: limitation.en.md

+++ title = "Limitations" weight = 1 +++ The SQL federation query of Apache ShardingSphere is experimental. des; SQL routing to multiple data nodes is divided, because of complexity issues, into three conditions: stable support, experimental support, and no support. Full support for DML, DDL, DCL, TCL, and common DALs. Support for complex queries such as paging, de-duplication, sorting, grouping, aggregation, table association, etc. Support SCHEMA DDL and DML statements of PostgreSQL and openGauss database. When no schema is specified in SQL, default access to 'public' schema. Other schemas need to declare before the table name, and do not support 'SEARCH_PATH' to modify the schema search path. main statement SELECT ```sql SELECT selectexpr [, selectexpr ...] FROM tablereference [, tablereference ...] [WHERE predicates] [GROUP BY {col_name | position} [ASC | DESC], ...] [ORDER BY {col_name | position} [ASC | DESC], ...] [LIMIT {[offset,] rowcount | rowcount OFFSET offset}] ``` select_expr ```sql | [DISTINCT] COLUMN_NAME [AS] [alias] | (MAX | MIN | SUM | AVG)(COLUMN_NAME | alias) [AS] [alias] | COUNT(* | COLUMN_NAME | alias) [AS] [alias] ``` table_reference ```sql tblname [AS] alias] [indexhint_list] | tablereference ([INNER] | {LEFT|RIGHT} [OUTER]) JOIN tablefactor [JOIN ON conditionalexpr | USING (columnlist)] ``` Stable support is provided by the kernel when both the subquery and the outer query specify a shard key and the values of the slice key remain consistent. e.g: ```sql SELECT FROM (SELECT FROM torder WHERE orderid = 1) o WHERE o.order_id = 1; ``` Sub-query for can be stably supported by the kernel. e.g.: ```sql SELECT FROM (SELECT row_., rownum rownum FROM (SELECT * FROM torder) row_ WHERE rownum <= ?) WHERE rownum > ?; ``` MySQL, PostgreSQL, and openGauss are fully supported, Oracle and SQLServer are only partially supported due to more intricate paging queries. Pagination for Oracle and SQLServer needs to be handled by subqueries, and ShardingSphere supports paging-related subqueries. Oracle Support pagination by rownum ```sql SELECT FROM (SELECT row_., rownum rownum FROM (SELECT o.orderid as orderid FROM torder o JOIN torderitem i ON o.orderid = i.orderid) row_ WHERE rownum <= ?) WHERE rownum > ? ``` SQL Server Support pagination that coordinates TOP + ROW_NUMBER() OVER ```sql SELECT FROM (SELECT TOP (?) ROW_NUMBER() OVER (ORDER BY o.order_id DESC) AS rownum, FROM torder o) AS temp WHERE temp.rownum > ? ORDER BY

``` Support pagination by OFFSET FETCH after SQLServer 2012 ```sql SELECT * FROM t_order o ORDER BY id OFFSET ? ROW FETCH NEXT ? ROWS ONLY ``` MySQL, PostgreSQL and openGauss all support LIMIT pagination without the need for sub-query ```sql SELECT * FROM t_order o ORDER BY id LIMIT ? OFFSET ? ``` When the sharding key is contained in an expression, the value used for sharding cannot be extracted through the SQL letters and will result in full routing. For example, assume `create_time` is a sharding key. ```sql SELECT * FROM torder WHERE todate(create_time, 'yyyy-mm-dd') = '2019-01-01'; ``` Support MySQL `LOAD DATA` and `LOAD XML` statements to load data to single table and broadcast table. Experimental support refers specifically to support provided by implementing Federation execution engine, an experimental product that is still under development. Although largely available to users, it still requires significant optimization. The Federation execution engine provides support for subqueries and outer queries that do not both specify a sharding key or have inconsistent values for the sharding key. e.g: ```sql SELECT FROM (SELECT FROM t_order) o; SELECT FROM (SELECT FROM torder) o WHERE o.orderid = 1; SELECT FROM (SELECT FROM torder WHERE orderid = 1) o; SELECT FROM (SELECT FROM torder WHERE orderid = 1) o WHERE o.order_id = 2; ``` When multiple tables in an associated query are distributed across different database instances, the Federation execution engine can provide support. Assuming that torder and torderitem are sharded tables with multiple data nodes while no binding table rules are configured, and tuser and tuserrole are single tables distributed across different database instances, then the Federation execution engine can support the following common associated queries. ```sql SELECT * FROM torder o INNER JOIN torderitem i ON o.orderid = i.orderid WHERE o.orderid = 1; SELECT * FROM torder o INNER JOIN tuser u ON o.userid = u.userid WHERE o.user_id = 1; SELECT * FROM torder o LEFT JOIN tuserrole r ON o.userid = r.userid WHERE o.userid = 1; SELECT * FROM torderitem i LEFT JOIN tuser u ON i.userid = u.userid WHERE i.userid = 1; SELECT * FROM torderitem i RIGHT JOIN tuserrole r ON i.userid = r.userid WHERE i.user_id = 1; SELECT * FROM tuser u RIGHT JOIN tuserrole r ON u.userid = r.userid WHERE u.userid = 1; ``` The following CASE WHEN statements are not supported: `CASE WHEN` contains sub-query Logic names are used in `CASE WHEN`( Please use an alias) Due to the complexity of paging queries, there are currently some paging queries that are not supported for Oracle and SQLServer, such as: Oracle The paging method of rownum + BETWEEN is not supported at present SQLServer Currently, pagination with WITH xxx AS (SELECT ...) is not supported. Since the SQLServer paging statement automatically generated by Hibernate uses the WITH statement, Hibernate-based SQLServer paging is not supported at this moment. Pagination using two TOP + subquery also cannot be supported at this time. Not support MySQL `LOAD DATA` and `LOAD XML` statements to load data to sharding table.