From 2e4cf1151123c0a3bc2c2ce593a3a57d5f3852c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 16 Dec 2024 18:43:45 +0100 Subject: [PATCH 01/10] functions: Add TIDB_MVCC_INFO and TIDB_ENCODE_INDEX_KEY --- functions-and-operators/tidb-functions.md | 74 ++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 91f24fc0038d3..a858d95cb0a03 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -18,8 +18,10 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_DECODE_KEY()`](#tidb_decode_key) | Decodes a TiDB-encoded key entry into a JSON structure containing `_tidb_rowid` and `table_id`. These encoded keys can be found in some system tables and logging outputs. | | [`TIDB_DECODE_PLAN()`](#tidb_decode_plan) | Decodes a TiDB execution plan. | | [`TIDB_DECODE_SQL_DIGESTS()`](#tidb_decode_sql_digests) | Queries the normalized SQL statements (a form without formats and arguments) corresponding to a set of SQL digests in the cluster. | +| [`TIDB_ENCODE_INDEX_KEY()`](#tidb_encode_index_key) | Encodes an index key. | | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | +| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns MVCC info about a key. | | [`TIDB_PARSE_TSO()`](#tidb_parse_tso) | Extracts the physical timestamp from a TiDB TSO timestamp. See also: [`tidb_current_ts`](/system-variables.md#tidb_current_ts). | | [`TIDB_PARSE_TSO_LOGICAL()`](#tidb_parse_tso_logical) | Extracts the logical timestamp from a TiDB TSO timestamp. | | [`TIDB_ROW_CHECKSUM()`](#tidb_row_checksum) | Queries the checksum value of a row. This function can only be used in `SELECT` statements within the FastPlan process. That is, you can query through statements like `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id = ?` or `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id IN (?, ?, ...)`. See also: [Data integrity validation for single-row data](/ticdc/ticdc-integrity-check.md). | @@ -40,9 +42,11 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_DECODE_KEY()`](#tidb_decode_key) | Decodes a TiDB-encoded key entry into a JSON structure containing `_tidb_rowid` and `table_id`. These encoded keys can be found in some system tables and logging outputs. | | [`TIDB_DECODE_PLAN()`](#tidb_decode_plan) | Decodes a TiDB execution plan. | | [`TIDB_DECODE_SQL_DIGESTS()`](#tidb_decode_sql_digests) | Queries the normalized SQL statements (a form without formats and arguments) corresponding to a set of SQL digests in the cluster. | +| [`TIDB_ENCODE_INDEX_KEY()`](#tidb_encode_index_key) | Encodes an index key. | | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | | [`TIDB_PARSE_TSO()`](#tidb_parse_tso) | Extracts the physical timestamp from a TiDB TSO timestamp. See also: [`tidb_current_ts`](/system-variables.md#tidb_current_ts). | +| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns MVCC info about a key. | | [`TIDB_PARSE_TSO_LOGICAL()`](#tidb_parse_tso_logical) | Extracts the logical timestamp from a TiDB TSO timestamp. | | [`TIDB_ROW_CHECKSUM()`](#tidb_row_checksum) | Queries the checksum value of a row. This function can only be used in `SELECT` statements within the FastPlan process. That is, you can query through statements like `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id = ?` or `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id IN (?, ?, ...)`. See also: [Data integrity validation for single-row data](https://docs.pingcap.com/tidb/stable/ticdc-integrity-check). | | [`TIDB_SHARD()`](#tidb_shard) | Creates a shard index to scatter the index hotspot. A shard index is an expression index with a `TIDB_SHARD` function as the prefix.| @@ -573,4 +577,72 @@ SELECT VITESS_HASH(123); | 1155070131015363447 | +---------------------+ 1 row in set (0.00 sec) -``` \ No newline at end of file +``` + +## TIDB_ENCODE_INDEX_KEY + +Encodes an index key. + +```sql +CREATE TABLE t(id int PRIMARY KEY, a int, KEY `idx` (a)); +``` + +``` +Query OK, 0 rows affected (0.00 sec) +``` + +```sql +INSERT INTO t VALUES(1,1); +``` + +``` +Query OK, 1 row affected (0.00 sec) +``` + +```sql +SELECT TIDB_ENCODE_INDEX_KEY('test', 't', 'idx', 1, 1); +``` + +``` ++----------------------------------------------------------------------------+ +| TIDB_ENCODE_INDEX_KEY('test', 't', 'idx', 1, 1) | ++----------------------------------------------------------------------------+ +| 74800000000000007f5f698000000000000001038000000000000001038000000000000001 | ++----------------------------------------------------------------------------+ +1 row in set (0.00 sec) +``` + +## TIDB_MVCC_INFO + +Returns MVCC info for a key. The `TIDB_ENCODE_INDEX_KEY` function can be used to obtain a key. + +```sql +SELECT JSON_PRETTY(TIDB_MVCC_INFO('74800000000000007f5f698000000000000001038000000000000001038000000000000001')) AS info\G +``` + +``` +*************************** 1. row *************************** +info: [ + { + "key": "74800000000000007f5f698000000000000001038000000000000001038000000000000001", + "mvcc": { + "info": { + "values": [ + { + "start_ts": 454654803134119936, + "value": "MA==" + } + ], + "writes": [ + { + "commit_ts": 454654803134119937, + "short_value": "MA==", + "start_ts": 454654803134119936 + } + ] + } + } + } +] +1 row in set (0.00 sec) +``` From 80998164ce2914595f3e6a525d2680dd0f5e25bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 19 Dec 2024 09:40:18 +0100 Subject: [PATCH 02/10] Add TIDB_ENCODE_RECORD_KEY --- functions-and-operators/tidb-functions.md | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index a858d95cb0a03..080e1ed340100 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -19,6 +19,7 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_DECODE_PLAN()`](#tidb_decode_plan) | Decodes a TiDB execution plan. | | [`TIDB_DECODE_SQL_DIGESTS()`](#tidb_decode_sql_digests) | Queries the normalized SQL statements (a form without formats and arguments) corresponding to a set of SQL digests in the cluster. | | [`TIDB_ENCODE_INDEX_KEY()`](#tidb_encode_index_key) | Encodes an index key. | +| [`TIDB_ENCODE_RECORD_KEY()`](#tidb_encode_record_key) | Encodes a record key. | | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | | [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns MVCC info about a key. | @@ -43,6 +44,7 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_DECODE_PLAN()`](#tidb_decode_plan) | Decodes a TiDB execution plan. | | [`TIDB_DECODE_SQL_DIGESTS()`](#tidb_decode_sql_digests) | Queries the normalized SQL statements (a form without formats and arguments) corresponding to a set of SQL digests in the cluster. | | [`TIDB_ENCODE_INDEX_KEY()`](#tidb_encode_index_key) | Encodes an index key. | +| [`TIDB_ENCODE_RECORD_KEY()`](#tidb_encode_record_key) | Encodes a record key. | | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | | [`TIDB_PARSE_TSO()`](#tidb_parse_tso) | Extracts the physical timestamp from a TiDB TSO timestamp. See also: [`tidb_current_ts`](/system-variables.md#tidb_current_ts). | @@ -612,6 +614,52 @@ SELECT TIDB_ENCODE_INDEX_KEY('test', 't', 'idx', 1, 1); 1 row in set (0.00 sec) ``` +## TIDB_ENCODE_RECORD_KEY + +Encodes a record key. + +```sql +CREATE TABLE t(id int PRIMARY KEY, a int, KEY `idx` (a)); +``` + +``` +Query OK, 0 rows affected (0.00 sec) +``` + +```sql +INSERT INTO t VALUES(1,1); +``` + +``` +Query OK, 1 row affected (0.00 sec) +``` + +```sql +SELECT TIDB_ENCODE_RECORD_KEY('test', 't', 1); +``` + +``` ++----------------------------------------+ +| TIDB_ENCODE_RECORD_KEY('test', 't', 1) | ++----------------------------------------+ +| 7480000000000000845f728000000000000001 | ++----------------------------------------+ +1 row in set (0.00 sec) +``` + +```sql +SELECT TIDB_DECODE_KEY('7480000000000000845f728000000000000001'); +``` + +``` ++-----------------------------------------------------------+ +| TIDB_DECODE_KEY('7480000000000000845f728000000000000001') | ++-----------------------------------------------------------+ +| {"id":1,"table_id":"132"} | ++-----------------------------------------------------------+ +1 row in set (0.00 sec) +``` + ## TIDB_MVCC_INFO Returns MVCC info for a key. The `TIDB_ENCODE_INDEX_KEY` function can be used to obtain a key. From 1ab6f6f104bdceef8791c509bf8ea7454828ea8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 24 Dec 2024 11:58:53 +0100 Subject: [PATCH 03/10] Update functions-and-operators/tidb-functions.md Co-authored-by: xixirangrang --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 080e1ed340100..d3da7831039f4 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -22,7 +22,7 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_ENCODE_RECORD_KEY()`](#tidb_encode_record_key) | Encodes a record key. | | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | -| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns MVCC info about a key. | +| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns the MVCC (Multi-Version Concurrency Control) information about a key. | | [`TIDB_PARSE_TSO()`](#tidb_parse_tso) | Extracts the physical timestamp from a TiDB TSO timestamp. See also: [`tidb_current_ts`](/system-variables.md#tidb_current_ts). | | [`TIDB_PARSE_TSO_LOGICAL()`](#tidb_parse_tso_logical) | Extracts the logical timestamp from a TiDB TSO timestamp. | | [`TIDB_ROW_CHECKSUM()`](#tidb_row_checksum) | Queries the checksum value of a row. This function can only be used in `SELECT` statements within the FastPlan process. That is, you can query through statements like `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id = ?` or `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id IN (?, ?, ...)`. See also: [Data integrity validation for single-row data](/ticdc/ticdc-integrity-check.md). | From 909e41a05c82f9512d54139a655433147fba46ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 30 Dec 2024 06:02:22 +0100 Subject: [PATCH 04/10] Update functions-and-operators/tidb-functions.md Co-authored-by: xixirangrang --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index d3da7831039f4..cd7a938753d86 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -48,7 +48,7 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | | [`TIDB_PARSE_TSO()`](#tidb_parse_tso) | Extracts the physical timestamp from a TiDB TSO timestamp. See also: [`tidb_current_ts`](/system-variables.md#tidb_current_ts). | -| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns MVCC info about a key. | +| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information about a key. | | [`TIDB_PARSE_TSO_LOGICAL()`](#tidb_parse_tso_logical) | Extracts the logical timestamp from a TiDB TSO timestamp. | | [`TIDB_ROW_CHECKSUM()`](#tidb_row_checksum) | Queries the checksum value of a row. This function can only be used in `SELECT` statements within the FastPlan process. That is, you can query through statements like `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id = ?` or `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id IN (?, ?, ...)`. See also: [Data integrity validation for single-row data](https://docs.pingcap.com/tidb/stable/ticdc-integrity-check). | | [`TIDB_SHARD()`](#tidb_shard) | Creates a shard index to scatter the index hotspot. A shard index is an expression index with a `TIDB_SHARD` function as the prefix.| From df0d368c244d876906bf4a751ce016ac252a07b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 30 Dec 2024 06:03:06 +0100 Subject: [PATCH 05/10] Update functions-and-operators/tidb-functions.md Co-authored-by: xixirangrang --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index cd7a938753d86..0e9059d8a3b56 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -662,7 +662,7 @@ SELECT TIDB_DECODE_KEY('7480000000000000845f728000000000000001'); ## TIDB_MVCC_INFO -Returns MVCC info for a key. The `TIDB_ENCODE_INDEX_KEY` function can be used to obtain a key. +Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information for a key. You can use the [`TIDB_ENCODE_INDEX_KEY`](#TIDB_ENCODE_INDEX_KEY) function to obtain a key. ```sql SELECT JSON_PRETTY(TIDB_MVCC_INFO('74800000000000007f5f698000000000000001038000000000000001038000000000000001')) AS info\G From 7f29b6b8686b61aba1ee4a6a866fc53f86a5deb6 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Mon, 6 Jan 2025 10:25:04 +0800 Subject: [PATCH 06/10] Update functions-and-operators/tidb-functions.md Co-authored-by: Grace Cai --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 0e9059d8a3b56..6802cb3acb0ce 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -662,7 +662,7 @@ SELECT TIDB_DECODE_KEY('7480000000000000845f728000000000000001'); ## TIDB_MVCC_INFO -Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information for a key. You can use the [`TIDB_ENCODE_INDEX_KEY`](#TIDB_ENCODE_INDEX_KEY) function to obtain a key. +Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information for a key. You can use the [`TIDB_ENCODE_INDEX_KEY`](tidb_encode_index_key) function to obtain a key. ```sql SELECT JSON_PRETTY(TIDB_MVCC_INFO('74800000000000007f5f698000000000000001038000000000000001038000000000000001')) AS info\G From 3e384bcf4ceadde076f88ab40b5be28e1d4cae61 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Mon, 6 Jan 2025 10:28:45 +0800 Subject: [PATCH 07/10] Update functions-and-operators/tidb-functions.md --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 6802cb3acb0ce..2f81facb8c96d 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -662,7 +662,7 @@ SELECT TIDB_DECODE_KEY('7480000000000000845f728000000000000001'); ## TIDB_MVCC_INFO -Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information for a key. You can use the [`TIDB_ENCODE_INDEX_KEY`](tidb_encode_index_key) function to obtain a key. +Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information for a key. You can use the [`TIDB_ENCODE_INDEX_KEY`](#tidb_encode_index_key) function to obtain a key. ```sql SELECT JSON_PRETTY(TIDB_MVCC_INFO('74800000000000007f5f698000000000000001038000000000000001038000000000000001')) AS info\G From 2b1a6e1902a56039f57348c4e796a7d9c0dbc181 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Mon, 6 Jan 2025 10:33:42 +0800 Subject: [PATCH 08/10] Update functions-and-operators/tidb-functions.md --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 2f81facb8c96d..25ad26a8cde65 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -662,7 +662,7 @@ SELECT TIDB_DECODE_KEY('7480000000000000845f728000000000000001'); ## TIDB_MVCC_INFO -Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information for a key. You can use the [`TIDB_ENCODE_INDEX_KEY`](#tidb_encode_index_key) function to obtain a key. +Returns the [MVCC (Multi-Version Concurrency Control)](https://docs.pingcap.com/tidb/stable/glossary#multi-version-concurrency-control-mvcc) information for a key. You can use the [`TIDB_ENCODE_INDEX_KEY`](#tidb_encode_index_key) function to obtain a key. ```sql SELECT JSON_PRETTY(TIDB_MVCC_INFO('74800000000000007f5f698000000000000001038000000000000001038000000000000001')) AS info\G From a70933aa268b3dd2fcb6e58612c1c6c4fdae62c5 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Mon, 6 Jan 2025 14:53:01 +0800 Subject: [PATCH 09/10] Update functions-and-operators/tidb-functions.md --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 25ad26a8cde65..2863b8ad8aeca 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -48,7 +48,7 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | | [`TIDB_PARSE_TSO()`](#tidb_parse_tso) | Extracts the physical timestamp from a TiDB TSO timestamp. See also: [`tidb_current_ts`](/system-variables.md#tidb_current_ts). | -| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns the [MVCC (Multi-Version Concurrency Control)](/glossary.md#multi-version-concurrency-control-mvcc) information about a key. | +| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns the [MVCC (Multi-Version Concurrency Control)](https://docs.pingcap.com/tidb/stable/glossary#multi-version-concurrency-control-mvcc) information about a key. | | [`TIDB_PARSE_TSO_LOGICAL()`](#tidb_parse_tso_logical) | Extracts the logical timestamp from a TiDB TSO timestamp. | | [`TIDB_ROW_CHECKSUM()`](#tidb_row_checksum) | Queries the checksum value of a row. This function can only be used in `SELECT` statements within the FastPlan process. That is, you can query through statements like `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id = ?` or `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id IN (?, ?, ...)`. See also: [Data integrity validation for single-row data](https://docs.pingcap.com/tidb/stable/ticdc-integrity-check). | | [`TIDB_SHARD()`](#tidb_shard) | Creates a shard index to scatter the index hotspot. A shard index is an expression index with a `TIDB_SHARD` function as the prefix.| From 34a54e1bf9fdba022d6e6eb9719bc5ab6808fd19 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Mon, 6 Jan 2025 14:53:46 +0800 Subject: [PATCH 10/10] Update functions-and-operators/tidb-functions.md --- functions-and-operators/tidb-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 2863b8ad8aeca..3f32dfd8938c1 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -22,7 +22,7 @@ The following functions are TiDB extensions, and are not present in MySQL: | [`TIDB_ENCODE_RECORD_KEY()`](#tidb_encode_record_key) | Encodes a record key. | | [`TIDB_ENCODE_SQL_DIGEST()`](#tidb_encode_sql_digest) | Gets a digest for a query string. | | [`TIDB_IS_DDL_OWNER()`](#tidb_is_ddl_owner) | Checks whether or not the TiDB instance you are connected to is the DDL Owner. The DDL Owner is the TiDB instance that is tasked with executing DDL statements on behalf of all other nodes in the cluster. | -| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns the MVCC (Multi-Version Concurrency Control) information about a key. | +| [`TIDB_MVCC_INFO()`](#tidb_mvcc_info) | Returns the [MVCC (Multi-Version Concurrency Control)](https://docs.pingcap.com/tidb/stable/glossary#multi-version-concurrency-control-mvcc) information about a key. | | [`TIDB_PARSE_TSO()`](#tidb_parse_tso) | Extracts the physical timestamp from a TiDB TSO timestamp. See also: [`tidb_current_ts`](/system-variables.md#tidb_current_ts). | | [`TIDB_PARSE_TSO_LOGICAL()`](#tidb_parse_tso_logical) | Extracts the logical timestamp from a TiDB TSO timestamp. | | [`TIDB_ROW_CHECKSUM()`](#tidb_row_checksum) | Queries the checksum value of a row. This function can only be used in `SELECT` statements within the FastPlan process. That is, you can query through statements like `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id = ?` or `SELECT TIDB_ROW_CHECKSUM() FROM t WHERE id IN (?, ?, ...)`. See also: [Data integrity validation for single-row data](/ticdc/ticdc-integrity-check.md). |