For the current version of TDSQL, you cannot configure user permissions on the command line. Instead, you need to log in to console to do so.
The current version of TDSQL does not support features such as custom function, view, trigger, and foreign key.
For more information on the compatibility with MySQL syntax, please see Use Limits.
When you use a sharded table, you are recommended to perform the SELECT operation with the shardkey, so that the route will be automatically redirected to the corresponding shard, achieving a higher efficiency. You can also perform the operation without the shardkey, but the system will automatically perform a full-table scan, which is less efficient.
When you use a sharded table, the shardkey must be included in an INSERT/REPLACE or DELETE/UPDATE operation; otherwise, the operations will be rejected. An INSERT/REPLACE operation requires the shardkey to be specified, indicating the location of the physical shard where the data is to be inserted. A DELETE/UPDATE operation requires the shardkey to be specified as a means of validation to avoid accidental deletion.
The shardkey is a data table field used to generate the splitting rules during horizontal splitting (sharding), which should be specified when the table is created. For TDSQL, you are recommended to find the entity of the data in the data table on the business logic, determine that the majority or core part of database operations are performed around the data of the entity, and then use the field corresponding to the entity as the shardkey for sharding (this scheme is called Group-Shard) as shown below:
Group-Shard ensures that some correlated data entries and complex business logic computation in different sharded tables can be aggregated into one physical shard. For example, if both the order table and user table of an ecommerce platform are sharded by UserID
, then the platform can quickly calculate how many orders a user has recently placed through join queries (with no cross-node joins or distributed transactions caused).
Below are some typical application scenarios for shardkey selection:
Once selected, the shardkey should not be arbitrarily changed. If you want to modify the shardkey of a table, you can do so only by creating another table.
If you want to modify the shardkey value in a row in a sharded table, you need to perform an INSERT operation first and then perform a DELETE operation. Direct UPDATE operations cannot modify the shardkey value.
For now, TDSQL only supports joins and transactions under a single shardkey and cross-node transactions but not cross-node joins.
Was this page helpful?