Hints are important supplementary to the SQL syntax in databases. You can use hints in a SQL statement to change the method in which the SQL statement is executed. LindormTable supports hints in SQL statements. For example, you can use hints in LindormTable SQL statements to manage multiple versions of data. This topic describes the syntax and scenarios of hints in LindormTable.
- Hints are supported by LindormTable 2.3.1 and later. For more information about how to upgrade the version of LindormTable, see Upgrade the minor engine version of a Lindorm instance.
- Hints can be used only after the INSERT, UPSERT, and SELECT keywords in SQL statements.
- Hints cannot be used in SQL statements that are executed to perform complex queries, such as subqueries and group queries.
- Hints do not support the PreparedStatement method.
hintExpression ::= /*+ hintItems */ hintItems ::= hintItem (',' hintItem )* hintItem ::= identifier ('(' hintOption ( ',' hintOption)* ')')? hintOption ::= expression
- Hints are used in the
/*+ hintItems */format, in which
hintItemsindicates operation-specific hints. Multiple
hintItemsare separated by commas (,).
- Hints are enclosed by
UPSERT /*+ _l_ts_(3000) */ INTO t_test_ts(c1, c3) VALUES (1, 'c3'); SELECT /*+ _l_versions_(1) */ c1, c3, c3_l_ts FROM t_test_ts;
UPSERT INTO /*+ _l_ts_(3000) */ t_test_ts(c1, c3) VALUES (1, 'c3');.
You can use hints in the following scenarios: