Clarify in the secondary index section too that we need to be careful of continuous values
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 617
- Forks
- 724
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 223
Description
Change Request
-
Describe what you find is inappropriate or missing in the existing docs.
It is carefully cautioned in the docs that we need to be careful not to specify continuous values as primary key (such as auto increment)
https://docs.pingcap.com/tidb/stable/dev-guide-create-table#guidelines-to-follow-when-selecting-primary-key
However, it doesn't seem to be emphasized for the secondary index.
https://docs.pingcap.com/tidb/stable/dev-guide-create-secondary-indexes
I wonder, for example, it is very common to have an index on a continuous value such as updated_at. As secondary indexes are also just another key value record, won't this also cause hotspots?
If that is the case I think it will be nicer to also caution that in the secondary index section and also suggest some workaround practices.
I think the best practices note this point briefly?
"The situation gets worse when some index values of the continuous written data is also continuous (for example, fields that increase with time, like update time), which creates a few write hotspots and becomes the bottleneck of the entire system."
https://docs.pingcap.com/tidb/stable/tidb-best-practices -
Describe your suggestion or addition.
Caution the usage of continuous value in secondary index section and add suggestions for workaround. -
Provide some reference materials (such as documents and websites) if you could.
https://docs.pingcap.com/tidb/stable/dev-guide-create-table#guidelines-to-follow-when-selecting-primary-key
https://docs.pingcap.com/tidb/stable/dev-guide-create-secondary-indexes
https://docs.pingcap.com/tidb/stable/tidb-best-practices
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the secondary-index page and compare its guidance with the primary-key guidelines and the TiDB best-practices note linked in the issue. Confirm how continuous secondary-index values relate to write hotspots, then document the caution and supported workaround practices in the secondary-index section. Done means the new guidance is clear and consistent with the referenced pages.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100