Skip to content

Commit

Permalink
cloud: add doc changes for v6.5 (pingcap#12041) (pingcap#12139)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jan 18, 2023
1 parent e172615 commit a0395ee
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 92 deletions.
16 changes: 16 additions & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- [Follower Read](/develop/dev-guide-use-follower-read.md)
- [Stale Read](/develop/dev-guide-use-stale-read.md)
- [HTAP Queries](/develop/dev-guide-hybrid-oltp-and-olap-queries.md)
- [FastScan](/develop/dev-guide-use-fastscan.md)
- Transaction
- [Overview](/develop/dev-guide-transaction-overview.md)
- [Optimistic and Pessimistic Transactions](/develop/dev-guide-optimistic-and-pessimistic-transaction.md)
Expand Down Expand Up @@ -149,6 +150,7 @@
- [Aggregation](/explain-aggregation.md)
- [Views](/explain-views.md)
- [Partitions](/explain-partitions.md)
- [Index Merge](/explain-index-merge.md)
- SQL Optimization Process
- [Overview](/sql-optimization-concepts.md)
- Logic Optimization
Expand All @@ -165,6 +167,7 @@
- [Overview](/sql-physical-optimization.md)
- [Index Selection](/choose-index.md)
- [Statistics](/statistics.md)
- [Extended Statistics](/extended-statistics.md)
- [Wrong Index Solution](/wrong-index-solution.md)
- [Distinct Optimization](/agg-distinct-optimization.md)
- [Cost Model](/cost-model.md)
Expand Down Expand Up @@ -288,6 +291,8 @@
- [`EXECUTE`](/sql-statements/sql-statement-execute.md)
- [`EXPLAIN ANALYZE`](/sql-statements/sql-statement-explain-analyze.md)
- [`EXPLAIN`](/sql-statements/sql-statement-explain.md)
- [`FLASHBACK CLUSTER TO TIMESTAMP`](/sql-statements/sql-statement-flashback-to-timestamp.md)
- [`FLASHBACK DATABASE`](/sql-statements/sql-statement-flashback-database.md)
- [`FLASHBACK TABLE`](/sql-statements/sql-statement-flashback-table.md)
- [`FLUSH PRIVILEGES`](/sql-statements/sql-statement-flush-privileges.md)
- [`FLUSH STATUS`](/sql-statements/sql-statement-flush-status.md)
Expand All @@ -296,11 +301,13 @@
- [`GRANT <role>`](/sql-statements/sql-statement-grant-role.md)
- [`INSERT`](/sql-statements/sql-statement-insert.md)
- [`KILL [TIDB]`](/sql-statements/sql-statement-kill.md)
- [`LOCK STATS`](/sql-statements/sql-statement-lock-stats.md)
- [`MODIFY COLUMN`](/sql-statements/sql-statement-modify-column.md)
- [`PREPARE`](/sql-statements/sql-statement-prepare.md)
- [`RECOVER TABLE`](/sql-statements/sql-statement-recover-table.md)
- [`RENAME INDEX`](/sql-statements/sql-statement-rename-index.md)
- [`RENAME TABLE`](/sql-statements/sql-statement-rename-table.md)
- [`RENAME USER`](/sql-statements/sql-statement-rename-user.md)
- [`REPLACE`](/sql-statements/sql-statement-replace.md)
- [`REVOKE <privileges>`](/sql-statements/sql-statement-revoke-privileges.md)
- [`REVOKE <role>`](/sql-statements/sql-statement-revoke-role.md)
Expand All @@ -319,6 +326,7 @@
- [`SHOW CHARACTER SET`](/sql-statements/sql-statement-show-character-set.md)
- [`SHOW COLLATION`](/sql-statements/sql-statement-show-collation.md)
- [`SHOW [FULL] COLUMNS FROM`](/sql-statements/sql-statement-show-columns-from.md)
- [`SHOW CREATE DATABASE`](/sql-statements/sql-statement-show-create-database.md)
- [`SHOW CREATE SEQUENCE`](/sql-statements/sql-statement-show-create-sequence.md)
- [`SHOW CREATE TABLE`](/sql-statements/sql-statement-show-create-table.md)
- [`SHOW CREATE USER`](/sql-statements/sql-statement-show-create-user.md)
Expand All @@ -340,6 +348,7 @@
- [`SHOW SCHEMAS`](/sql-statements/sql-statement-show-schemas.md)
- [`SHOW STATS_HEALTHY`](/sql-statements/sql-statement-show-stats-healthy.md)
- [`SHOW STATS_HISTOGRAMS`](/sql-statements/sql-statement-show-histograms.md)
- [`SHOW STATS_LOCKED`](/sql-statements/sql-statement-show-stats-locked.md)
- [`SHOW STATS_META`](/sql-statements/sql-statement-show-stats-meta.md)
- [`SHOW STATUS`](/sql-statements/sql-statement-show-status.md)
- [`SHOW TABLE NEXT_ROW_ID`](/sql-statements/sql-statement-show-table-next-rowid.md)
Expand All @@ -354,6 +363,7 @@
- [`TABLE`](/sql-statements/sql-statement-table.md)
- [`TRACE`](/sql-statements/sql-statement-trace.md)
- [`TRUNCATE`](/sql-statements/sql-statement-truncate.md)
- [`UNLOCK STATS`](/sql-statements/sql-statement-unlock-stats.md)
- [`UPDATE`](/sql-statements/sql-statement-update.md)
- [`USE`](/sql-statements/sql-statement-use.md)
- [`WITH`](/sql-statements/sql-statement-with.md)
Expand Down Expand Up @@ -408,6 +418,7 @@
- [Usage Scenarios of Stale Read](/stale-read.md)
- [Perform Stale Read Using `As OF TIMESTAMP`](/as-of-timestamp.md)
- [Perform Stale Read Using `tidb_read_staleness`](/tidb-read-staleness.md)
- [Perform Stale Read Using `tidb_external_ts`](/tidb-external-ts.md)
- [Use the `tidb_snapshot` System Variable](/read-historical-data.md)
- System Tables
- [`mysql`](/mysql-schema.md)
Expand All @@ -427,6 +438,8 @@
- [`DEADLOCKS`](/information-schema/information-schema-deadlocks.md)
- [`ENGINES`](/information-schema/information-schema-engines.md)
- [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md)
- [`MEMORY_USAGE`](/information-schema/information-schema-memory-usage.md)
- [`MEMORY_USAGE_OPS_HISTORY`](/information-schema/information-schema-memory-usage-ops-history.md)
- [`PARTITIONS`](/information-schema/information-schema-partitions.md)
- [`PROCESSLIST`](/information-schema/information-schema-processlist.md)
- [`REFERENTIAL_CONSTRAINTS`](/information-schema/information-schema-referential-constraints.md)
Expand All @@ -446,9 +459,12 @@
- [`TIKV_REGION_PEERS`](/information-schema/information-schema-tikv-region-peers.md)
- [`TIKV_REGION_STATUS`](/information-schema/information-schema-tikv-region-status.md)
- [`TIKV_STORE_STATUS`](/information-schema/information-schema-tikv-store-status.md)
- [`USER_ATTRIBUTES`](/information-schema/information-schema-user-attributes.md)
- [`USER_PRIVILEGES`](/information-schema/information-schema-user-privileges.md)
- [`VARIABLES_INFO`](/information-schema/information-schema-variables-info.md)
- [`VIEWS`](/information-schema/information-schema-views.md)
- [Metadata Lock](/metadata-lock.md)
- [Use UUIDs](/best-practices/uuid.md)
- [System Variables](/system-variables.md)
- Storage Engines
- TiKV
Expand Down
24 changes: 23 additions & 1 deletion best-practices/uuid.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,36 @@ The textual UUID format looks like this: `ab06f63e-8fe7-11ec-a514-5405db7aad56`,

### UUID format binary order and a clustered PK

The `UUID_TO_BIN()` function can be used with one argument, the UUID or with two arguments where the second argument is a `swap_flag`. It is recommended to not set the `swap_flag` with TiDB to avoid [hotspots](/best-practices/high-concurrency-best-practices.md).
The `UUID_TO_BIN()` function can be used with one argument, the UUID or with two arguments where the second argument is a `swap_flag`.

<CustomContent platform="tidb">

It is recommended to not set the `swap_flag` with TiDB to avoid [hotspots](/best-practices/high-concurrency-best-practices.md).

</CustomContent>

<CustomContent platform="tidb-cloud">

It is recommended to not set the `swap_flag` with TiDB to avoid hotspots.

</CustomContent>

You can also explicitly set the [`CLUSTERED` option](/clustered-indexes.md) for UUID based primary keys to avoid hotspots.

To demonstrate the effect of the `swap_flag`, here are two tables with an identical structure. The difference is that the data inserted into `uuid_demo_1` uses `UUID_TO_BIN(?, 0)` and `uuid_demo_2` uses `UUID_TO_BIN(?, 1)`.

<CustomContent platform="tidb">

In the screenshot of the [Key Visualizer](/dashboard/dashboard-key-visualizer.md) below, you can see that writes are concentrated in a single region of the `uuid_demo_2` table that has the order of the fields swapped in the binary format.

</CustomContent>

<CustomContent platform="tidb-cloud">

In the screenshot of the [Key Visualizer](/tidb-cloud/tune-performance.md#key-visualizer) below, you can see that writes are concentrated in a single region of the `uuid_demo_2` table that has the order of the fields swapped in the binary format.

</CustomContent>

![Key Visualizer](/media/best-practices/uuid_keyviz.png)

```sql
Expand Down
6 changes: 6 additions & 0 deletions develop/dev-guide-choose-driver-or-orm.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,9 @@ go get -u gorm.io/driver/mysql
```

For an example of using GORM to build a TiDB application, see [Build a Simple CRUD App with TiDB and Golang](/develop/dev-guide-sample-application-golang.md).

<CustomContent platform="tidb-cloud">

After you have determined the driver or ORM, you can [connect to your TiDB cluster](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster).

</CustomContent>
7 changes: 1 addition & 6 deletions explain-subqueries.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,4 @@ Currently, TiDB can only be null-aware of anti semi join and anti left outer sem
+ [Explain Statements That Use Aggregation](/explain-aggregation.md)
+ [Explain Statements Using Views](/explain-views.md)
+ [Explain Statements Using Partitions](/explain-partitions.md)

<CustomContent platform="tidb">

+ [Explain Statements Using Index Merge](/explain-index-merge.md)

</CustomContent>
+ [Explain Statements Using Index Merge](/explain-index-merge.md)
Loading

0 comments on commit a0395ee

Please sign in to comment.