Skip to content

Commit

Permalink
Merge docs special week branch to master (pingcap#3372)
Browse files Browse the repository at this point in the history
* *: udpate part of TOC and create new files

* *: add more topics

* �*: add more topics to toc and create files

* toc: add assignee to two topics

* *: add some issue topics

* *: add some troubleshoot topics

* *: add performance tuning topics

* *: add tutorial topics

* *: add more topics

* *: add more reference topics

* tidb-binlog: create binlogctl file

* perf-tuning:adjust the structure of the `SQL tuning` section (pingcap#3149)

* faq, toc: add faq and ui topics

* toc: update troubleshoot and sql tuning

* TOC: add database tools section (pingcap#3161)

* TOC: add database tools section

* fix ci

* relocate the section

* add assignees

* add /faq/licensing-faq.md

* modify assignees

* Update command line flags for pd configruation (pingcap#3153)

Signed-off-by: nolouch <[email protected]>

Co-authored-by: Lilian Lee <[email protected]>

* Remove tiflash section in old TOC (commented out) to prevent lint error (pingcap#3194)

* toc: remove topics that are commented out

* Remove upgrade-tiflash.md (pingcap#3164)

Duplicated with TiDB's upgrade manual.

Co-authored-by: ruoxi <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* sql-statements: update "admin" related statements (pingcap#3175)

* add tiflash faq (pingcap#3167)

* add tiflash faq

* delete original tiflash faq

* fix ci

* address comment

* Revert "fix ci"

This reverts commit 73dff28.

Co-authored-by: Keke Yi <[email protected]>

* toc: remove inapplicable dm topics

* Remove two inapplicable files

* Add lightning faq (pingcap#3176)

* .github: add three github action workflows (pingcap#3213)

* .github: update workflow to auto assign project (pingcap#3229)

* update tikv configuration about pessimistic transaction (pingcap#3178)

* update tikv configuration about pessimistic transaction

Signed-off-by: youjiali1995 <[email protected]>

* Update tikv-configuration-file.md

Co-authored-by: TomShawn <[email protected]>

* Update tikv-configuration-file.md

Co-authored-by: toutdesuite <[email protected]>

Co-authored-by: TomShawn <[email protected]>
Co-authored-by: toutdesuite <[email protected]>

* Add TiFlash performance tuning to TOC (pingcap#3203)

* tuning: add tune-operating-system (pingcap#3157)

* tuning: add tune-operating-system

Signed-off-by: Wenbo Zhang <[email protected]>

* refine format and TOC

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

* Update tune-operating-system.md

Co-authored-by: Keke Yi <[email protected]>

Co-authored-by: yikeke <[email protected]>
Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* add doc about tiflash command line flags (pingcap#3205)

* add doc about tiflash command line flags

* Small fix for format

* Try fix link

* Update tiflash/tiflash-command-line-flags.md

Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* split to DDL DML DQL DCL sections (pingcap#3215)

* Add files via upload

* update format

* Update basic-sql-operations.md

Co-authored-by: Ran <[email protected]>

* Update command line flags for tikv configruation (pingcap#3155)

* update mysql-compatibility.md & add auto-increment.md (pingcap#3163)

* perf-tuning: Add document for column prune (pingcap#3190)

* *: Update documents and sqlgrams with "alter" prefixed statements (pingcap#3235)

* transaction-isolation-levels.md: update txn isolation (pingcap#3140)

* Update error-codes.md (pingcap#3160)

* Update tidb-specific-system-variables.md (pingcap#3159)

* reference: Optimize documents about GC (pingcap#3158)

* add troubleshooting-writeconflict (pingcap#3209)

* add troubleshooting-writeconflict

* fix syntax

* fix snytax again

* adjust

* fix format

* refine format and wording

Co-authored-by: yikeke <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* reference: update constraints.md (pingcap#3146)

* update literal-values.md (pingcap#3236)

* perf-tuning: Update the doc of query-execution-plan (pingcap#3201)

* Update configfile pd (pingcap#3238)

 *: update PD config file

Signed-off-by: nolouch <[email protected]>

* reference: update the pd-ctl docs (pingcap#3305)

* update the pd-ctl docs

Signed-off-by: Ryan Leung <[email protected]>

* perf-tuning: add document for predicate push down (pingcap#3181)

* toc: remove /tidb-index.md (pingcap#3258)

* perf-tuning: add docs for DISTINCT optimizations (pingcap#3214)

* *: update some statements (pingcap#3300)

* update transaction overview (pingcap#3165)

* update generate ssl doc (pingcap#3260)

* resources: update the Figma link (pingcap#3230)

* update generate ssl

Signed-off-by: TXXT <[email protected]>

* update generate ssl

Signed-off-by: TXXT <[email protected]>

* revert

Signed-off-by: TXXT <[email protected]>

* Apply suggestions from code review

Co-authored-by: Keke Yi <[email protected]>

* safe point

Signed-off-by: TXXT <[email protected]>

* fix format to pass ci

* update code block format

* address comments

Signed-off-by: TXXT <[email protected]>

* Apply suggestions from code review

Co-authored-by: Keke Yi <[email protected]>

Co-authored-by: Caitin <[email protected]>
Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: yikeke <[email protected]>

* perf-tuning: add introduction for prepare plan cache (pingcap#3187)

* Fix sql-statement: use, update, truncate, trace (pingcap#3255)

* fix use

* fix pic

* fix pic

* update doc

* update doc

Co-authored-by: Lilian Lee <[email protected]>

* update document of privilege management (pingcap#3202)

* update privilege document

* Apply suggestions from code review

Co-authored-by: Lilian Lee <[email protected]>

Co-authored-by: kissmydb <[email protected]>
Co-authored-by: Lilian Lee <[email protected]>
Co-authored-by: Jack Yu <[email protected]>

* perf-tuning: add index-choose.md (pingcap#3173)

* Add documentations for TiUP (pingcap#3197)

* tiup: improve the TiUP related documents

Signed-off-by: Lonng <[email protected]>

* add fag/troubleshoot documents

Signed-off-by: Lonng <[email protected]>

* add TiUP to TOC.md

Signed-off-by: Lonng <[email protected]>

* add aliases to redirect old links

* Apply suggestions from code review

Co-authored-by: Keke Yi <[email protected]>

* address comment

Signed-off-by: Lonng <[email protected]>

* refine TOC and a filename

* fix ci

* Update tiup/tiup-cluster.md

Co-authored-by: Keke Yi <[email protected]>

* fix a dead link

* fix a link

* fix a link

* address comments

Signed-off-by: Lonng <[email protected]>

Co-authored-by: yikeke <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* update the tidb configuration document (pingcap#3148)

* update configure file document

* update command line arguments doc

* update

* update

* update

* update

* update

* update

* update

* update

* update

* fix a typo in tiup doc

Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: yikeke <[email protected]>

* update all the syntax png files (pingcap#3322)

* add shutdown statement (pingcap#3306)

* reference: update statement summary tables (pingcap#3145)

* Add Grafana monitoring content and update images (pingcap#3195)

* perf-tuning: add doc for wrong index solution page (pingcap#3302)

* add/update several sql statements docs (pingcap#3299)

* Add docs for rocksdb (pingcap#3198)

* add docs for rocksdb

Signed-off-by: Little-Wallace <[email protected]>

* update several sql statements (pingcap#3298)

 - sql-statements/sql-statement-set-names.md
 - sql-statements/sql-statement-show-columns-from.md
 - sql-statements/sql-statement-show-create-sequence.md

* add show config statement (pingcap#3308)

* add & update several sql statements (pingcap#3296)

* *: udpate `begin` and `commit` statements (pingcap#3301)

* perf-tuning: update docs for statistics (pingcap#3223)

* Update tispark doc (pingcap#3257)

* update some syntax diagram (pingcap#3312)

Signed-off-by: crazycs520 <[email protected]>

* update several statements (pingcap#3309)

* add document of `SHOW PLUGINS` (pingcap#3326)

* Add doc about next_row_id and profiles (pingcap#3316)

* update comment-syntax.md (pingcap#3193)

* update keywords-and-reserved-words.md (pingcap#3246)

* update document of tidb-ctl (pingcap#3189)

* update the doc of view (pingcap#3179)

* update functions-and-operator documents (pingcap#3318)

* update some syntax diagram (pingcap#3317)

* add syntax diagram for show stats_buckets (pingcap#3321)

* perf-tuning: add docs for subquery optimizations (pingcap#3191)

* perf-tuning: add docs for some overview pages for sql-tuning (pingcap#3170)

* perf-tuning: add docs for some overview pages

* Update query-execution-plan.md

* Apply suggestions from code review

Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: Zhuomin(Charming) Liu <[email protected]>

* Update control-execution-plan.md

Co-authored-by: Keke Yi <[email protected]>

* Update sql-tuning-overview.md

* Update control-execution-plan.md

Co-authored-by: Zhang Jian <[email protected]>

Co-authored-by: TomShawn <[email protected]>
Co-authored-by: 苗青利 <[email protected]>
Co-authored-by: Zhang Jian <[email protected]>
Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: Zhuomin(Charming) Liu <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* update sql-statement-modify-column.md (pingcap#3323)

* add topology YAML template (pingcap#3279)

* add topology YAML template

* fix topology YAML template

* fix topology YAML template

* update topology YAML template

* sql-statements:add drop-stats.md (pingcap#3337)

* sql-statements: update create view and drop view (pingcap#3331)

* perf-tuning: add document for partition pruning (pingcap#3184)

* docs: add sql statement for load data (pingcap#3335)

* Create monitor-deploy.md and tidb-monitoring-api.md (pingcap#3196)

* Create monitor-deploy.md

deploy monitor

* Update TOC.md

add monitor deploy

* Update monitor-deploy.md

* Delete monitor-a-tidb-cluster.md

delete

* Update monitor-deploy.md

* Rename monitor-deploy.md to deploy-monitoring-services.md

* Update TOC.md

* add pingcap#3186 document

* add alias

* Update mysql-compatibility.md

* Update deploy-monitoring-services.md

* 整理监控报警相关 TOC

* Update deploy-monitoring-services.md

* Update tidb-monitoring-api.md

Co-authored-by: TomShawn <[email protected]>

* Update tidb-monitoring-api.md

Co-authored-by: TomShawn <[email protected]>
Co-authored-by: kissmydb <[email protected]>

* Update upgrade-tidb-using-tiup.md (pingcap#3212)

* Update upgrade-tidb-using-tiup.md

* Update upgrade-tidb-using-tiup.md

* Update upgrade-tidb-using-tiup.md

Co-authored-by: Lilian Lee <[email protected]>

* Update upgrade-tidb-using-tiup.md

Co-authored-by: Lilian Lee <[email protected]>

* Update upgrade-tidb-using-tiup.md

Co-authored-by: Lilian Lee <[email protected]>

Co-authored-by: kissmydb <[email protected]>
Co-authored-by: Lilian Lee <[email protected]>

* update several document related to privilege sql statement (pingcap#3310)

* update create user gramma

* update serveral statment doc

* refine punctuation

* Update sql-statements/sql-statement-grant-privileges.md

Co-authored-by: Keke Yi <[email protected]>

* Update sql-statements/sql-statement-revoke-privileges.md

Co-authored-by: Keke Yi <[email protected]>

Co-authored-by: yikeke <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* update optimistic transaction (pingcap#3171)

* *: update "change column" and some sqlgram (pingcap#3304)

* Update three-data-centers-in-two-cities-deployment.md (pingcap#3243)

* Add files via upload

* Update three-data-centers-in-two-cities-deployment.md

* fix ci and update format

* Update three-data-centers-in-two-cities-deployment.md

Co-authored-by: Ran <[email protected]>

* Update post-installation-check.md (pingcap#3297)

* Multi-data-centers-in-one-city-deployment  (pingcap#3245)

* sql statements: add create binding, drop binding and show bindings (pingcap#3333)

* refine enable tls for client/components (pingcap#3325)

* fix hardware-and-software-requirements (pingcap#3228)

* update security-compatibility-with-mysql.md (pingcap#3311)

* Update scale-tidb-using-tiup.md and production-offline-deployment-using-tiup.md (pingcap#3208)

* update several statements (pingcap#3289)

* update pessimistic transaction (pingcap#3177)

* Add syntax gram of `show stats_meta` (pingcap#3338)

* update schema-object-names.md (pingcap#3242)

* add sql statement for show analyze status (pingcap#3329)

* Update the sql diagram of SHOW TABLES and SHOW INDEXES. (pingcap#3346)

* update syntax gram for `kill`, `prepare` and `show stats_healthy` (pingcap#3319)

* update expression-syntax.md (pingcap#3313)

* Update sql diagrams of show statements (pingcap#3277)

* Update the docs of `drop database` (pingcap#3332)

* update partition-table.md (pingcap#3216)

* update placement rules (pingcap#3169)

Signed-off-by: disksing <[email protected]>

* add troubleshoot-hot-spot-issues  (pingcap#3276)

* picture of troubleshoot-hot-spot-issues

* troubleshoot-hot-spot-issues v1

* Update troubleshoot-hot-spot-issues.md

Co-authored-by: kissmydb <[email protected]>

* Update troubleshoot-hot-spot-issues.md

* Update troubleshoot-hot-spot-issues.md

* Update troubleshoot-hot-spot-issues.md

* Update troubleshoot-hot-spot-issues.md

* a little fix

Co-authored-by: kissmydb <[email protected]>
Co-authored-by: pepezzzz <[email protected]>

* Add troubleshooting CPU issues (pingcap#3282)

* Create troubleshooting-cpu.md

* Update troubleshoot-cpu-issues.md

* Delete troubleshooting-cpu.md

* Update troubleshoot-cpu-issues.md

Co-authored-by: TomShawn <[email protected]>

* Update troubleshoot-cpu-issues.md

Co-authored-by: TomShawn <[email protected]>

* Update troubleshoot-cpu-issues.md

* Update troubleshoot-cpu-issues.md

* Update troubleshoot-cpu-issues.md

* refine format

* Spoken language modified to written language

* Update troubleshoot-cpu-issues.md

Co-authored-by: TomShawn <[email protected]>
Co-authored-by: pepezzzz <[email protected]>
Co-authored-by: kissmydb <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* Docs special week for troubleshoot-lock-conflicts (pingcap#3206)

* troubleshoot-lock-conflicts-pictures

add pictures for troubleshoot-lock-conflicts

* add file troubleshoot-lock-conflicts

add file troubleshoot-lock-conflicts

* Update SW troubleshoot-lock-conflicts

Update SW troubleshoot-lock-conflicts

* refine format and content

* Update SW troubleshoot-lock-conflicts

Update SW troubleshoot-lock-conflicts

* Update troubleshoot-lock-conflicts.md

Co-authored-by: Keke Yi <[email protected]>

* Update SW troubleshoot-lock-conflicts

Update SW troubleshoot-lock-conflicts

* Update the ci format for troubleshooting lock conflicts

Update the ci format for troubleshooting lock conflicts

* refine content

* fix indentation

* change category

Co-authored-by: yikeke <[email protected]>
Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: kissmydb <[email protected]>

* *: update `analyze` statement (pingcap#3241)

`

* Move TiFlash troubleshoot part to a new document (pingcap#3192)

* update TiDB metrics (pingcap#3284)

* add experimental warning (pingcap#3330)

* tiny refine cert based authentication (pingcap#3328)

* add a dir for config-templates (pingcap#3349)

* sql-stmt: modify SelectStmt and add page for `SHOW STATS_HISTOGRAMS` (pingcap#3336)

* update tikv-ctl doc (pingcap#3254)

* TOC: remove unused pages (pingcap#3339)

* Update document for generated column (pingcap#3295)

* update the 'Overview' metrics doc for grafana dashboard (pingcap#3286)

* add deployment and operation FAQ (pingcap#3268)

* best-practice: update massive regions to match 4.0 (pingcap#3152)

* Update grafana-monitor-best-practices.md (pingcap#3288)

* tools: add data migration route (pingcap#3292)

* update user-defined-variables.md (pingcap#3271)

* perf-tuning: Add document for topn-limit-push-down (pingcap#3307)

* add minimal-deploy-topology.md (pingcap#3226)

* add sql statement about pump and drainer (pingcap#3324)

* add hybrid-deployment-topology.md (pingcap#3227)

* add ticdc-deploy-topology.md (pingcap#3281)

* add tiflash-deploy-topology.md (pingcap#3285)

* update user-account-management.md (pingcap#3211)

* update user-account-management.md

* fix lint?

* Apply suggestions from code review

Co-authored-by: Lilian Lee <[email protected]>

* Apply suggestions from code review

* Update user-account-management.md

Co-authored-by: Jack Yu <[email protected]>
Co-authored-by: Lilian Lee <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* add doc for slow-queries in dashboard (pingcap#3274)

* add doc for slow-queries in dashboard

Signed-off-by: crazycs520 <[email protected]>

* address comment

Signed-off-by: crazycs520 <[email protected]>

* update format

* Apply suggestions from code review

Co-authored-by: Ran <[email protected]>

* update relative paths

* Update list.md

* update alt text and punctuation

* change name and dir

* rename picture

Signed-off-by: crazycs520 <[email protected]>

Co-authored-by: Ran <[email protected]>
Co-authored-by: Wenxuan <[email protected]>

* add check-before-deployment.md (pingcap#3225)

* add check-befor-deployment.md

* Update check-before-deployment.md

Co-authored-by: kissmydb <[email protected]>

* Update check-before-deployment.md

Co-authored-by: Ran <[email protected]>

* Update check-before-deployment.md

Co-authored-by: Ran <[email protected]>

* Update check-before-deployment.md

Co-authored-by: Ran <[email protected]>

* Update check-before-deployment.md

Co-authored-by: Ran <[email protected]>

* Update check-before-deployment.md

Co-authored-by: Ran <[email protected]>

* Update check-before-deployment.md

* Update check-before-deployment.md

* Update check-before-deployment.md

* Update check-before-deployment.md

* Update check-before-deployment.md

Co-authored-by: Zhang Jian <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lilian Lee <[email protected]>

Co-authored-by: kissmydb <[email protected]>
Co-authored-by: Ran <[email protected]>
Co-authored-by: Zhang Jian <[email protected]>
Co-authored-by: Lilian Lee <[email protected]>

* Add daily-inspection.md (pingcap#3221)

* cdc: update cdc cli doc (pingcap#3141)

* add geographic-redundancy-deploy-topology.md (pingcap#3283)

* Add tikv overview (pingcap#3249)

* add tikv overview

Signed-off-by: Little-Wallace <[email protected]>

* add upgrade faq (pingcap#3267)

* add tidb-binlog-deploy-topology.md (pingcap#3280)

* update character-set-and-collation (pingcap#3256)

* update several sql statement docs (pingcap#3294)

* Add document of dumpling, the new export tool (pingcap#3151)

* Create configure-load-base-split.md (pingcap#3168)

* Create configure-load-base-split.md

* TiFlash: Modify scale doc structure (pingcap#3341)

Co-authored-by: Flowyi <[email protected]>
Co-authored-by: kissmydb <[email protected]>
Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: yikeke <[email protected]>

* update doc credits (pingcap#3248)

* update doc credits

Signed-off-by: shirly <[email protected]>

* address comments

Signed-off-by: shirly <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lilian Lee <[email protected]>

* Update credits.md

Co-authored-by: winkyao <[email protected]>
Co-authored-by: Lilian Lee <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* Add FAQ documents to BR (pingcap#3344)

* tools: update toc for binlog (pingcap#3347)

* update several 'CREATE' related statement: (pingcap#3293)

* Update grafana pd dashboard (pingcap#3343)

* add scheduling overview from tidb in action (pingcap#3180)

* Add some experimental features of br (pingcap#3143)

* br: add online restore, raw kv.

* br: warp line of some commands.

* br: fix a dead link.

* Update br/backup-and-restore-tool.md

Co-authored-by: kissmydb <[email protected]>

* Apply suggestions from code review

Co-authored-by: TomShawn <[email protected]>
Co-authored-by: WangXiangUSTC <[email protected]>

* Update backup-and-restore-tool.md

* refine format

* br: fix incremental backup time range.

* br: add a hint of where the backup stores

* br: add a hint of local storage

* Update backup-and-restore-tool.md

* Update br/backup-and-restore-tool.md

Co-authored-by: Neil Shen <[email protected]>

* Update backup-and-restore-tool.md

* Update br/backup-and-restore-tool.md

Co-authored-by: TomShawn <[email protected]>

* Update backup-and-restore-tool.md

* Update br/backup-and-restore-tool.md

Co-authored-by: kissmydb <[email protected]>
Co-authored-by: TomShawn <[email protected]>
Co-authored-by: WangXiangUSTC <[email protected]>
Co-authored-by: Neil Shen <[email protected]>

* Some optimization configuration for TiKV (pingcap#3278)

* add optimize for tikv

Signed-off-by: Little-Wallace <[email protected]>

* add blank

Signed-off-by: Little-Wallace <[email protected]>

* rename some file

Signed-off-by: Little-Wallace <[email protected]>

* fix some link

Signed-off-by: Little-Wallace <[email protected]>

* fix blank

Signed-off-by: Little-Wallace <[email protected]>

* fix some comment

Signed-off-by: Little-Wallace <[email protected]>

* Update tune-tikv-performance-thread.md

Co-authored-by: Lilian Lee <[email protected]>

* Update tune-tikv-performance-thread.md

Co-authored-by: Lilian Lee <[email protected]>

* Update faq/tidb-faq.md

Co-authored-by: Lilian Lee <[email protected]>

* fix grafana

Signed-off-by: Little-Wallace <[email protected]>

* Update tune-tikv-performance-thread.md

Co-authored-by: Lilian Lee <[email protected]>

* Update tune-tikv-performance-thread.md

Co-authored-by: Lilian Lee <[email protected]>

* Update faq/tidb-faq.md

Co-authored-by: Lilian Lee <[email protected]>

* rename file

Signed-off-by: Little-Wallace <[email protected]>

* add code format

Signed-off-by: Little-Wallace <[email protected]>

* address comment

Signed-off-by: Little-Wallace <[email protected]>

* Update tune-tikv-thread-performance.md

* Apply suggestions from code review

* Fix format

* Apply suggestions from code review

Co-authored-by: Lilian Lee <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* add troubleshoot-high-disk-io.md (pingcap#3237)

* system-table: update diagnose system table doc (pingcap#3154)

* Update tidb-best-practices.md (pingcap#3291)

* optimize production-deployment-using-tiup (pingcap#3224)

* Update grafana tikv dashboard doc (pingcap#3150)

Signed-off-by: TXXT <[email protected]>

Co-authored-by: Connor <[email protected]>
Co-authored-by: Ran <[email protected]>
Co-authored-by: Lei Zhao <[email protected]>
Co-authored-by: qupeng <[email protected]>
Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: zhangjinpeng1987 <[email protected]>

* Update tiflash usage (pingcap#3351)

* Add tiflash intro into TOC (pingcap#3355)

* Update sql-faq.md (pingcap#3262)

* tools: update toc for cdc (pingcap#3352)

* update ticdc

* add link in ticdc overview

* update link

* fix link

* add aliases

* Update TOC.md

Co-authored-by: Keke Yi <[email protected]>

* fix link

* combine deploy ticdc to manage ticdc

* update title

* Update manage-ticdc.md

* Update production-deployment-using-tiup.md

* move ticdc files to ticdc folder

* fix links

* Update manage-ticdc.md

* Update ticdc-overview.md

* fix a link

Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: kissmydb <[email protected]>
Co-authored-by: yikeke <[email protected]>

* migrate: migrate from mysql files (pingcap#3252)

* perf-tuning: add blacklist-control-plan.md (pingcap#3253)

* Update benchmark-tidb-using-tpcc.md (pingcap#3354)

* Update benchmark-tidb-using-tpcc.md

* Update benchmark-tidb-using-tpcc.md

* Update benchmark/benchmark-tidb-using-tpcc.md

* Update format

Co-authored-by: Lilian Lee <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* update maintain-tidb-using-tiup.md (pingcap#3204)

* architecture: add tidb-architecture, tidb-computing, tidb-storage (pingcap#3222)

* dashboard: add docs for cluster info, statement, log search pages (pingcap#3247)

* Add Dashboard TOC

Signed-off-by: Breezewish <[email protected]>

* dashboard: add docs about cluster info page

* dashboard: add docs about statement list page

* dashboard: add docs about statement detail page

* dashboard: add docs about log search page

* dashboard: add missed content for statement detail page

* dashboard: fix CI

* dashboard: address the comments

Signed-off-by: baurine <[email protected]>

* refine

* Update cluster-info.md

* Update log-search.md

* Update detail.md

* Update list.md

* dashboard: add summary meta

* adjust files structure

* fix CI

* fix CI

* fix CI

* Update dashboard/dashboard-statements-list.md

Co-authored-by: 混沌DM <[email protected]>

* Update dashboard/dashboard-cluster-info.md

Co-authored-by: 混沌DM <[email protected]>

* update file name

Co-authored-by: Breezewish <[email protected]>
Co-authored-by: Wenxuan <[email protected]>
Co-authored-by: 混沌DM <[email protected]>

* Update Dashboard Key-Visualizer Page (pingcap#3250)

* Update overview.md (pingcap#3166)

* add some note of TiCDC (pingcap#3356)

* Add store limit guide (pingcap#3353)

* dashboard: update dashboard media files structure (pingcap#3359)

* dashboard: update media files structure

* fix link

Co-authored-by: TomShawn <[email protected]>

* add `SET ROLE` document (pingcap#3358)

* Add Dashboard Access, Overview and Profiling Page (pingcap#3244)

* Add Dashboard TOC

Signed-off-by: Breezewish <[email protected]>

* Add Access, Overview and Profiling Page

Signed-off-by: Breezewish <[email protected]>

* Fix lint

Signed-off-by: Breezewish <[email protected]>

* Address comments

Signed-off-by: Breezewish <[email protected]>

* Update some doc styles

Signed-off-by: Breezewish <[email protected]>

* Rename files

Signed-off-by: Breezewish <[email protected]>

* Rename

Signed-off-by: Breezewish <[email protected]>

* Make CI happy

Signed-off-by: Breezewish <[email protected]>

* Update dashboard/dashboard-profiling.md

Co-authored-by: 混沌DM <[email protected]>

* Update dashboard/dashboard-access.md

Co-authored-by: 混沌DM <[email protected]>

* Move images

Signed-off-by: Breezewish <[email protected]>

* Fix deadlink

Signed-off-by: Breezewish <[email protected]>

Co-authored-by: 混沌DM <[email protected]>

* combine duplicate doc (pingcap#3361)

* combine duplicate doc:

 - sql-statements/sql-statement-show-table-next-row-id.md
 - sql-statements/sql-statement-show-table-next-rowid.md

* fix link

Co-authored-by: yikeke <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* Add syntax gram of `load stats`  (pingcap#3362)

* resources: update the Figma link (pingcap#3230)

* load stats

* add png

* make linter happy

* Update sql-statements/sql-statement-load-stats.md

Co-authored-by: Lynn <[email protected]>

* update

Co-authored-by: Caitin <[email protected]>
Co-authored-by: Lynn <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* Add new sql statements to TOC.md (pingcap#3357)

* Add doc for cluster diagnose in dashboard (pingcap#3273)

* architecture: fix link (pingcap#3365)

* architecture: fix link

* Update tidb-computing.md

Co-authored-by: Keke Yi <[email protected]>

Co-authored-by: pingcap-github-bot <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* tools: update toc for data migration (pingcap#3363)

* add migration by sql

* update toc

* Update data-migration-route.md

Co-authored-by: Keke Yi <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lilian Lee <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* remove duplicate content

Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: Lilian Lee <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>

* delete extra aliases (pingcap#3367)

* delete extra aliases

* Update sql-statement-alter-index.md

* Update sql-statement-change-column.md

* update dashboard diagnostics pickture name (pingcap#3366)

* update dashboard diagnostics pickture name

Signed-off-by: crazycs520 <[email protected]>

* update link

Signed-off-by: crazycs520 <[email protected]>

* fix typos

Co-authored-by: TomShawn <[email protected]>
Co-authored-by: Keke Yi <[email protected]>

* add plan_from_cache in slow_query document (pingcap#3369)

* add plan_from_cache in slow_query document

* Update identify-slow-queries.md

Co-authored-by: Lilian Lee <[email protected]>

* improve location-awareness (pingcap#3174)

* improve location-awareness

Signed-off-by: disksing <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* Update location-awareness.md

Co-authored-by: Keke Yi <[email protected]>

* rename the file and add an alias

* update title

* fix CI

* fix 2 links

* Update TOC.md

Co-authored-by: Keke Yi <[email protected]>
Co-authored-by: yikeke <[email protected]>

* tidy up docs-special-week branch (pingcap#3368)

* remove names and refs

* tidy up TOC; add draft attribute; fix minor issues

* draft:true -> draft: true

* refine TOC

* rename a file; delete extra empty files

* fix 4 dead links due to renaming

* rename a file; add an alias

* <br> -> <br/>

* Update descriptions and format (pingcap#3370)

* 修改一些描述的层次格式

* 修改缩进

* Update troubleshoot-high-disk-io.md

* Update troubleshoot-high-disk-io.md

* Update indentation

* Update troubleshoot-high-disk-io.md

* Update troubleshoot-high-disk-io.md

update 一些段落格式

Co-authored-by: Lilian Lee <[email protected]>

* add backticks to fix build issues (pingcap#3371)

* add backticks to fix build issues

* remove extra slash

* revert frontmatter changes

* Update tune-tiflash-performance.md

* delete extra assignee names

* fix two build issues

Co-authored-by: lilin90 <[email protected]>
Co-authored-by: Yiding Cui <[email protected]>
Co-authored-by: ShuNing <[email protected]>
Co-authored-by: ruoxi <[email protected]>
Co-authored-by: Flowyi <[email protected]>
Co-authored-by: Lynn <[email protected]>
Co-authored-by: xufei <[email protected]>
Co-authored-by: 3pointer <[email protected]>
Co-authored-by: Ran <[email protected]>
Co-authored-by: Lei Zhao <[email protected]>
Co-authored-by: TomShawn <[email protected]>
Co-authored-by: toutdesuite <[email protected]>
Co-authored-by: JaySon <[email protected]>
Co-authored-by: Zwb <[email protected]>
Co-authored-by: pingcap-github-bot <[email protected]>
Co-authored-by: lidezhu <[email protected]>
Co-authored-by: pepezzzz <[email protected]>
Co-authored-by: tangenta <[email protected]>
Co-authored-by: lawyerphx <[email protected]>
Co-authored-by: cfzjywxk <[email protected]>
Co-authored-by: Zejun Li <[email protected]>
Co-authored-by: MyonKeminta <[email protected]>
Co-authored-by: Win-Man <[email protected]>
Co-authored-by: Jack Yu <[email protected]>
Co-authored-by: Chengpeng Yan <[email protected]>
Co-authored-by: Ryan Leung <[email protected]>
Co-authored-by: HuaiyuXu <[email protected]>
Co-authored-by: Feng Liyuan <[email protected]>
Co-authored-by: Xintao <[email protected]>
Co-authored-by: Caitin <[email protected]>
Co-authored-by: Kenan Yao <[email protected]>
Co-authored-by: djshow832 <[email protected]>
Co-authored-by: Lingyu Song <[email protected]>
Co-authored-by: kissmydb <[email protected]>
Co-authored-by: Zhuomin(Charming) Liu <[email protected]>
Co-authored-by: Lonng <[email protected]>
Co-authored-by: yuzhibotao <[email protected]>
Co-authored-by: bb7133 <[email protected]>
Co-authored-by: Wallace <[email protected]>
Co-authored-by: Liangliang Gu <[email protected]>
Co-authored-by: crazycs <[email protected]>
Co-authored-by: 苗青利 <[email protected]>
Co-authored-by: Zhang Jian <[email protected]>
Co-authored-by: lzs <[email protected]>
Co-authored-by: Shenghui Wu <[email protected]>
Co-authored-by: xiaoyangwang5 <[email protected]>
Co-authored-by: pcqz <[email protected]>
Co-authored-by: freyfl <[email protected]>
Co-authored-by: wentaojin <[email protected]>
Co-authored-by: lysu <[email protected]>
Co-authored-by: tiancaiamao <[email protected]>
Co-authored-by: King-Dylan <[email protected]>
Co-authored-by: Zhi Qi <[email protected]>
Co-authored-by: disksing <[email protected]>
Co-authored-by: DamonGuo@PingCAP <[email protected]>
Co-authored-by: KASSADAR <[email protected]>
Co-authored-by: zhenjiao gao <[email protected]>
Co-authored-by: lei yu <[email protected]>
Co-authored-by: qupeng <[email protected]>
Co-authored-by: wjHuang <[email protected]>
Co-authored-by: glkappe <[email protected]>
Co-authored-by: Jay <[email protected]>
Co-authored-by: WangXiangUSTC <[email protected]>
Co-authored-by: Wenxuan <[email protected]>
Co-authored-by: Wang Jun <[email protected]>
Co-authored-by: Neil Shen <[email protected]>
Co-authored-by: 山岚 <[email protected]>
Co-authored-by: lhy1024 <[email protected]>
Co-authored-by: birdstorm <[email protected]>
Co-authored-by: Shirly <[email protected]>
Co-authored-by: winkyao <[email protected]>
Co-authored-by: TaoZhengCN <[email protected]>
Co-authored-by: Connor <[email protected]>
Co-authored-by: zhangjinpeng1987 <[email protected]>
Co-authored-by: yilongrong <[email protected]>
Co-authored-by: Se-L <[email protected]>
Co-authored-by: wangxj <[email protected]>
Co-authored-by: Sparkle <[email protected]>
Co-authored-by: Breezewish <[email protected]>
Co-authored-by: 混沌DM <[email protected]>
Co-authored-by: ruofly0425 <[email protected]>
Co-authored-by: leoppro <[email protected]>
Co-authored-by: Yuanjia Zhang <[email protected]>
  • Loading branch information
Show file tree
Hide file tree
Showing 950 changed files with 16,751 additions and 7,663 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/assign-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Assign to Project

on:
issues:
types: [opened, labeled]
pull_request:
types: [opened, labeled]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
assign_one_project:
runs-on: ubuntu-latest
name: Assign to Project
steps:
- name: Assign NEW issues to Docs SIG project
uses: srggrs/[email protected]
if: |
github.event_name == 'issues' &&
github.event.action == 'opened'
with:
project: 'https://github.com/pingcap/docs-cn/projects/1'
column_name: 'Issue: Backlog'
- name: Assign NEW pull requests to Docs SIG project
uses: srggrs/[email protected]
if: |
github.event_name == 'pull_request' &&
github.event.action == 'opened'
with:
project: 'https://github.com/pingcap/docs-cn/projects/1'
column_name: 'PR: In Progress'
- name: Assign issues or PRs with translation-welcome label
uses: srggrs/[email protected]
if: |
contains(github.event.issue.labels.*.name, 'translation/welcome') ||
contains(github.event.pull_request.labels.*.name, 'translation/welcome')
with:
project: 'https://github.com/pingcap/docs-cn/projects/2'
column_name: 'To do'
669 changes: 359 additions & 310 deletions TOC.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions adopters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
draft: true
---
57 changes: 57 additions & 0 deletions agg-distinct-optimization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Distinct 优化
category: performance
---

# Distinct 优化

本文档介绍可用于 `DISTINCT` 的优化,包括简单 `DISTINCT` 和聚合函数 `DISTINCT` 的优化。

## 简单 DISTINCT

通常简单的 `DISTINCT` 会被优化成 GROUP BY 来执行。例如:

```sql
mysql> explain select DISTINCT a from t;
+--------------------------+---------+-----------+---------------+-------------------------------------------------------+
| id | estRows | task | access object | operator info |
+--------------------------+---------+-----------+---------------+-------------------------------------------------------+
| HashAgg_6 | 2.40 | root | | group by:test.t.a, funcs:firstrow(test.t.a)->test.t.a |
| └─TableReader_11 | 3.00 | root | | data:TableFullScan_10 |
| └─TableFullScan_10 | 3.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+--------------------------+---------+-----------+---------------+-------------------------------------------------------+
3 rows in set (0.00 sec)
```

## 聚合函数 DISTINCT

通常来说,带有 `DISTINCT` 的聚合函数会单线程的在 TiDB 侧执行。
使用系统变量 [`tidb_opt_distinct_agg_push_down`](/tidb-specific-system-variables.md#tidb_opt_distinct_agg_push_down) 或者 TiDB 的配置项 [distinct-agg-push-down](/tidb-configuration-file.md#distinct-agg-push-down) 控制优化器是否执行带有 `DISTINCT` 的聚合函数(比如 `select count(distinct a) from t`)下推到 Coprocessor 的优化操作。

在以下示例中,`tidb_opt_distinct_agg_push_down` 开启前,TiDB 需要从 TiKV 读取所有数据,并在 TiDB 侧执行 `disctinct``tidb_opt_distinct_agg_push_down` 开启后,`distinct a` 被下推到了 Coprocessor,在 `HashAgg_5` 里新增了一个 `group by``test.t.a`

```sql
mysql> desc select count(distinct a) from test.t;
+-------------------------+----------+-----------+---------------+------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------+----------+-----------+---------------+------------------------------------------+
| StreamAgg_6 | 1.00 | root | | funcs:count(distinct test.t.a)->Column#4 |
| └─TableReader_10 | 10000.00 | root | | data:TableFullScan_9 |
| └─TableFullScan_9 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+-------------------------+----------+-----------+---------------+------------------------------------------+
3 rows in set (0.01 sec)

mysql> set session tidb_opt_distinct_agg_push_down = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> desc select count(distinct a) from test.t;
+---------------------------+----------+-----------+---------------+------------------------------------------+
| id | estRows | task | access object | operator info |
+---------------------------+----------+-----------+---------------+------------------------------------------+
| HashAgg_8 | 1.00 | root | | funcs:count(distinct test.t.a)->Column#3 |
| └─TableReader_9 | 1.00 | root | | data:HashAgg_5 |
| └─HashAgg_5 | 1.00 | cop[tikv] | | group by:test.t.a, |
| └─TableFullScan_7 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+---------------------------+----------+-----------+---------------+------------------------------------------+
4 rows in set (0.00 sec)
```
202 changes: 202 additions & 0 deletions auto-increment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
---
title: AUTO_INCREMENT
category: reference
summary: 介绍 TiDB 的 `AUTO_INCREMENT` 列属性。
---

# AUTO_INCREMENT

本文介绍列属性 `AUTO_INCREMENT` 的基本概念、实现原理、自增相关的特性,以及使用限制。

## 基本概念

`AUTO_INCREMENT` 是用于自动填充缺省列值的列属性。当 `INSERT` 语句没有指定 `AUTO_INCREMENT` 列的具体值时,系统会自动地为该列分配一个值。该值满足唯一性,以及**特殊情况下**的递增性和连续性。使用示例如下:

{{< copyable "sql" >}}

```sql
create table t(id int primary key AUTO_INCREMENT, c int);
```

{{< copyable "sql" >}}

```sql
insert into t(c) values (1);
insert into t(c) values (2);
insert into t(c) values (3), (4), (5);
```

```sql
mysql> select * from t;
+----+---+
| id | c |
+----+---+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
+----+---+
5 rows in set (0.01 sec)
```

此外,`AUTO_INCREMENT` 还支持显式指定列值的插入语句,此时 TiDB 会保存显式指定的值:

{{< copyable "sql" >}}

```sql
insert into t(id, c) values (6, 6);
```

```sql
mysql> select * from t;
+----+---+
| id | c |
+----+---+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
+----+---+
6 rows in set (0.01 sec)
```

以上用法和 MySQL 的 `AUTO_INCREMENT` 用法一致。但在隐式分配的具体值方面,TiDB 和 MySQL 之间具有较为显著的差异。

## 实现原理

TiDB 实现 `AUTO_INCREMENT` 隐式分配的原理是,对于每一个自增列,都使用一个全局可见的键值对用于记录当前已分配的最大 ID。由于分布式环境下的节点通信存在一定开销,为了避免写请求放大的问题,每个 TiDB 节点在分配 ID 时,都申请一段 ID 作为缓存,用完之后再去取下一段,而不是每次分配都向存储节点申请。例如,对于以下新建的表:

```sql
create table t(id int unique key AUTO_INCREMENT, c int);
```

假设集群中有两个 TiDB 实例 A 和 B,如果向 A 和 B 分别对 `t` 执行一条插入语句:

```sql
insert into t (c) values (1)
```

实例 A 可能会缓存 `[1,30000]` 的自增 ID,而实例 B 则可能缓存 `[30001,60000]` 的自增 ID。各自实例缓存的 ID 将随着执行将来的插入语句被作为缺省值,顺序地填充到 `AUTO_INCREMENT` 列中。

## 基本特性

### 唯一性保证

> **警告:**
>
> 在集群中有多个 TiDB 实例时,如果表结构中有自增 ID,建议不要混用显式插入和隐式分配(即自增列的缺省值和自定义值),否则可能会破坏隐式分配值的唯一性。
例如在上述示例中,依次执行如下操作:

1. 客户端向实例 B 插入一条将 `id` 设置为 `2` 的语句 `insert into t values (2, 1)`,并执行成功。
2. 客户端向实例 A 发送 `Insert` 语句 `insert into t (c) (1)`,这条语句中没有指定 `id` 的值,所以会由 A 分配。当前 A 缓存了 `[1, 30000]` 这段 ID,可能会分配 `2` 为自增 ID 的值,并把本地计数器加 `1`。而此时数据库中已经存在 `id``2` 的数据,最终返回 `Duplicated Error` 错误。

### 递增性保证

`AUTO_INCREMENT` 列隐式分配值的递增性只能在含有单个 TiDB 实例的集群中得到保证:即对于同一个自增列,先分配的值小于后分配的值;而在含有多个 TiDB 实例的集群中,无法保证自增列的递增性。

例如,对于上述例子,如果先向实例 B 执行一条插入语句,再向实例 A 执行一条插入语句。根据缓存自增 ID 的性质,自增列隐式分配的值可能分别是 `30002``2`。因此从时间上看,不满足递增性。

### 连续性保证

在含有多个 TiDB 实例的集群中,`AUTO_INCREMENT` 分配值的连续性**只能**在 batch insert 语句中得到保证。

例如,对以下表执行以下语句:

```sql
create table t (a int primary key AUTO_INCREMENT)
```

```sql
insert into t values (), (), (), ()
```

即使存在正在执行并发写入的其他 TiDB 实例,或者当前实例剩余的缓存 ID 数量不够,都不会影响分配值的连续性。

### `_tidb_rowid` 的关联性

> **注意:**
>
> 在没有指定整数类型主键的情况下 TiDB 会使用 `_tidb_rowid` 来标识行,该数值的分配会和自增列(如果存在的话)共用一个分配器,其中缓存的大小可能会被自增列和 `_tidb_rowid` 共同消耗。因此会有以下的示例情况:
```sql
mysql> create table t(id int unique key AUTO_INCREMENT);
Query OK, 0 rows affected (0.05 sec)

mysql> insert into t values (),(),();
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0

mysql> select _tidb_rowid, id from t;
+-------------+------+
| _tidb_rowid | id |
+-------------+------+
| 4 | 1 |
| 5 | 2 |
| 6 | 3 |
+-------------+------+
3 rows in set (0.01 sec)
```

### 缓存大小控制

TiDB 自增 ID 的缓存大小在早期版本中是对用户透明的。从 v3.1.2、v3.0.14 和 v4.0.rc-2 版本开始,TiDB 引入了 `AUTO_ID_CACHE` 表选项来允许用户自主设置自增 ID 分配缓存的大小。例如:

```sql
mysql> create table t(a int auto_increment key) AUTO_ID_CACHE 100;
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t values();
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0

mysql> select * from t;
+---+
| a |
+---+
| 1 |
+---+
1 row in set (0.01 sec)
```

此时如果将该列的自增缓存无效化,重新进行隐式分配:

```sql
mysql> delete from t;
Query OK, 1 row affected (0.01 sec)

mysql> rename table t to t1;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values()
Query OK, 1 row affected (0.00 sec)

mysql> select * from t;
+-----+
| a |
+-----+
| 101 |
+-----+
1 row in set (0.00 sec)
```

可以看到再一次分配的值为 `101`,说明该表的自增 ID 分配缓存的大小为 `100`

此外如果在批量插入的 `INSERT` 语句中所需连续 ID 长度超过 `AUTO_ID_CACHE` 的长度时,TiDB 会适当调大缓存以便能够保证该语句的正常插入。

### 自增步长和偏移量设置

从 v3.0.9 和 v4.0.rc-1 开始,和 MySQL 的行为类似,自增列隐式分配的值遵循 session 变量 `@@auto_increment_increment``@@auto_increment_offset` 的控制,其中自增列隐式分配的值 (ID) 将满足式子 `(ID - auto_increment_offset) % auto_increment_increment == 0`

## 使用限制

目前在 TiDB 中使用 `AUTO_INCREMENT` 有以下限制:

- 必须定义在主键或者唯一索引的列上。
- 只能定义在类型为整数、`FLOAT``DOUBLE` 的列上。
- 不支持与列的默认值 `DEFAULT` 同时指定在同一列上。
- 不支持使用 `ALTER TABLE` 来添加 `AUTO_INCREMENT` 属性。
- 支持使用 `ALTER TABLE` 来移除 `AUTO_INCREMENT` 属性。但从 TiDB 2.1.18 和 3.0.4 版本开始,TiDB 通过 session 变量 `@@tidb_allow_remove_auto_inc` 控制是否允许通过 `ALTER TABLE MODIFY``ALTER TABLE CHANGE` 来移除列的 `AUTO_INCREMENT` 属性,默认是不允许移除。
7 changes: 4 additions & 3 deletions auto-random.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: AUTO_RANDOM
category: reference
summary: 本文介绍了 TiDB 的 `AUTO_RANDOM` 列属性。
aliases: ['/docs-cn/dev/reference/sql/attributes/auto-random/']
---

Expand Down Expand Up @@ -119,7 +120,7 @@ TiDB 支持解析版本注释语法。示例如下:
{{< copyable "sql" >}}

```sql
create table t (a bigint primary key /*T!30100 auto_random */)
create table t (a bigint primary key /*T![auto_rand] auto_random */)
```

{{< copyable "sql" >}}
Expand All @@ -130,9 +131,9 @@ create table t (a bigint primary key auto_random)

以上两个语句含义相同。

`show create table` 的结果中,`AUTO_RANDOM` 属性会被注释掉。注释会附带一个版本号,例如 `/*T!30100 auto_random */`。其中 `30100` 表示 v3.1.0 引入该功能,低版本的 TiDB 能够忽略带有上述注释的 `AUTO_RANDOM` 属性
`show create table` 的结果中,`AUTO_RANDOM` 属性会被注释掉。注释会附带一个特性标识符,例如 `/*T![auto_rand] auto_random */`。其中 `auto_rand` 表示 `AUTO_RANDOM` 的特性标识符,只有实现了该标识符对应特性的 TiDB 版本才能够正常解析 SQL 语句片段

该功能支持向前兼容,即降级兼容。v3.1.0 以前的 TiDB 会忽略表(带有上述注释)的 `AUTO_RANDOM` 属性,因此能够使用含有该属性的表。
该功能支持向前兼容,即降级兼容。没有实现对应特性的 TiDB 版本则会忽略表(带有上述注释)的 `AUTO_RANDOM` 属性,因此能够使用含有该属性的表。

## 使用限制

Expand Down
Loading

0 comments on commit a3c0b95

Please sign in to comment.