DistSQL #
Background #
DistSQL (Distributed SQL) is a query language unique to DBPlusEngine. It operates in the same way as standard SQL to provide SQL-level manipulation capabilities for incremental functionality in distributed systems. For more information, please refer to the Quick Reference Sheet:DistSQL.
Challenges #
DBPlusEngine has several features, including flexible rule configuration and resource control capabilities.
With DistSQL, users can operate DBPlusEngine like a database, transforming it from a developer-oriented framework and middleware into a database product for operations staff.
DistSQL is divided into four types: RDL, RQL, RAL, and RUL.
- RDL (Resource & Rule Definition Language) is responsible for creating, modifying, and deleting resources and rules.
- RQL (Resource & Rule Query Language) is responsible for querying and presenting resources and rules.
- RAL (Resource & Rule Administration Language) handles management functions such as Hint, transaction type switching, and sliced execution plan queries.
- RUL (Resource Utility Language) is a tool-like language for SphereEx-DBPlusEngine, providing SQL parsing, SQL formatting, execution plan preview, and other functions.
Goals #
DistSQL is designed to break down the boundaries between middleware and database, enabling developers to use DBPlusEngine as a database.
Notes #
DistSQL can only be used with DBPlusEngine-Proxy, DBPlusEngine-Driver is not available at this time.
Syntax Rules #
The input format of the elements in a DistSQL statement, other than keywords, should conform to the following rules.
Identifiers #
An identifier represents an object in a SQL statement and includes
- Database name
- table name
- Column name
- Index name
- Resource name
- Rule name
- Algorithm name The following characters are allowed in the identifier: [a-z,A-Z,0-9,_] (letters, numbers, underscores) and should start with a letter.
When keywords or special characters appear in the identifier, use backquotes (`).
Literal Quantities #
Literal quantities include strings, integer values and boolean values.
Strings: are sequences of characters enclosed by single (’) or double inverted commas (").
integer values: are generally positive integers, such as 0-9.
Note: Some DistSQL syntax allows negative values, in which case the number can be preceded by a negative sign (-), e.g. -1.
Boolean value: TRUE or FALSE, case insensitive.
Consistency #
After the DistSQL statement is executed, the metadata stored in the governance centre will be updated, and the metadata in the computing nodes will be updated synchronously. Consistency updates are available when the parameter meta-data-consistency-enabled=true is set.