From b7ed03051d589d4590c1a23f04c592eaec04dcaa Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Thu, 25 Nov 2021 15:23:51 +0800 Subject: [PATCH] Align 2 prs from docs-cn (sql and planner) (#7005) (#7012) --- optimizer-hints.md | 10 ++++++++++ sql-statements/sql-statement-create-sequence.md | 2 -- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/optimizer-hints.md b/optimizer-hints.md index 317056ba5e898..c6e55f4a4a697 100644 --- a/optimizer-hints.md +++ b/optimizer-hints.md @@ -191,6 +191,16 @@ The `AGG_TO_COP()` hint tells the optimizer to push down the aggregate operation select /*+ AGG_TO_COP() */ sum(t1.a) from t t1; ``` +### LIMIT_TO_COP() + +The `LIMIT_TO_COP()` hint tells the optimizer to push down the `Limit` and `TopN` operators in the specified query block to the coprocessor. If the optimizer does not perform such an operation, it is recommended to use this hint. For example: + +{{< copyable "sql" >}} + +```sql +SELECT /*+ LIMIT_TO_COP() */ * FROM t WHERE a = 1 AND b > 10 ORDER BY c LIMIT 1; +``` + ### READ_FROM_STORAGE(TIFLASH[t1_name [, tl_name ...]], TIKV[t2_name [, tl_name ...]]) The `READ_FROM_STORAGE(TIFLASH[t1_name [, tl_name ...]], TIKV[t2_name [, tl_name ...]])` hint tells the optimizer to read specific table(s) from specific storage engine(s). Currently, this hint supports two storage engine parameters - `TIKV` and `TIFLASH`. If a table has an alias, use the alias as the parameter of `READ_FROM_STORAGE()`; if the table does not has an alias, use the table's original name as the parameter. For example: diff --git a/sql-statements/sql-statement-create-sequence.md b/sql-statements/sql-statement-create-sequence.md index 85e33a4cb1eba..2df8370487168 100644 --- a/sql-statements/sql-statement-create-sequence.md +++ b/sql-statements/sql-statement-create-sequence.md @@ -48,7 +48,6 @@ CREATE [TEMPORARY] SEQUENCE [IF NOT EXISTS] sequence_name [ START [ WITH | = ] start ] [ CACHE [=] cache | NOCACHE | NO CACHE] [ CYCLE | NOCYCLE | NO CYCLE] - [ ORDER | NOORDER | NO ORDER] [table_options] ``` @@ -63,7 +62,6 @@ CREATE [TEMPORARY] SEQUENCE [IF NOT EXISTS] sequence_name | `START` | `MINVALUE` or `MAXVALUE`| Specifies the initial value of a sequence. When `INCREMENT` > `0`, the default value is `MINVALUE`. When `INCREMENT` < `0`, the default value is `MAXVALUE`. | | `CACHE` | `1000` | Specifies the local cache size of a sequence in TiDB. | | `CYCLE` | `NO CYCLE` | Specifies whether a sequence restarts from the minimum value (or maximum for the descending sequence). When `INCREMENT` > `0`, the default value is `MINVALUE`. When `INCREMENT` < `0`, the default value is `MAXVALUE`. | -| `ORDER` | `NO ORDER` | TiDB currently does not support the `ORDER` option and provides only syntax compatibility for it. | ## `SEQUENCE` function