Syntax of an SQL hint:
/*+ HINT_NAME */
Or
/*+ HINT_NAME ( HINT_PARA )
To connect to OceanBase Database from OceanBase Client (OBClient) or a MySQL client, be sure to specify the -c parameter so that the hint takes effect after it is sent to OBServer.
General SQL hints for OceanBase:
| Hint | Argument | Description |
|---|---|---|
| NO_REWRITE | Specifies not to rewrite the SQL statement. | |
| READ_CONSISTENCY | weak|strong|frozen | WEAK: weak consistency read STRONG: strong consistency read FROZEN: reads data from the last major freeze |
| INDEX_HINT | [ qb_name ] table_name index_name | Specifies the index used during a query on a table. |
| QUERY_TIMEOUT | int64 | Specifies the statement execution timeout value, in microseconds (us). |
| LEADING | [ qb_name ] table_name [, table _ name ] | Specifies the order in which multiple tables are joined. |
| ORDERED | Specifies the order in which the tables are displayed in an SQL table. | |
| FULL | [qb _name ] table_name | Specifies a full table scan as the access method (reads the primary key if any). |
| USE_MERGE | [qb _name ] table_name [, table_name ] | Specifies to use a MERGE algorithm for a multi-table join. |
| USE_NL | [ qb_name ] table_name [, table_name ] | Specifies to use a NEST LOOP algorithm for a multi-table join. |
| USE_BNL | [qb_name] table_name [,table_name] | Specifies to use a BLOCK NEST LOOP algorithm for a multi-table join. |
| USE_HASH_AGGREGATION | [ qb_name ] | Specifies to use a HASH AGGREGATE method, for example, HASH GROUP BY and HASH DISTINCT, as the aggregate method. |
| NO_USE_HASH_AGGREGATION | [ qb_name ] | Specifies to use the MERGE GROUP BY and MERGE DISTINCT methods for aggregate, instead of HASH AGGREGATE. |
| QB_NAME | qb_name | Specifies the name of the query block. |
| PARALLEL | int64 | Specifies the degree of parallelism of distributed execution. |