Skip to content

Commit

Permalink
include limitation of LIKE when it works with non-binary collation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
songrijie authored Nov 16, 2023
1 parent c1c66aa commit 68e00ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions character-set-and-collation.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ SHOW COLLATION;
> **Warning:**
>
> TiDB incorrectly treats latin1 as a subset of utf8. This can lead to unexpected behaviors when you store characters that differ between latin1 and utf8 encodings. It is strongly recommended to the utf8mb4 character set. See [TiDB #18955](https://github.com/pingcap/tidb/issues/18955) for more details.
>
> If the predicates include `LIKE` for string prefixes, such as `LIKE 'prefix%'`, and the target column is set to a non-binary collation (the suffix does not end with `_bin`), the optimizer currently cannot convert this predicate into a range scan. Instead, it performs a full scan. As a result, such SQL queries might lead to unexpected resource consumption.
> **Note:**
>
Expand Down
2 changes: 2 additions & 0 deletions character-set-gbk.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ In the above table, the result of `SELECT HEX('a');` in the `utf8mb4` byte set i

- Currently, for binary characters of the `ENUM` and `SET` types, TiDB deals with them as the `utf8mb4` character set.

- If the predicates include `LIKE` for string prefixes, such as `LIKE 'prefix%'`, and the target column is set to a GBK collation (either `gbk_bin` or `gbk_chinese_ci`), the optimizer currently cannot convert this predicate into a range scan. Instead, it performs a full scan. As a result, such SQL queries might lead to unexpected resource consumption.

## Component compatibility

- Currently, TiFlash does not support the GBK character set.
Expand Down

0 comments on commit 68e00ec

Please sign in to comment.