Issues with TiFlash Primary Key

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tiflash主键问题

| username: llllllll

Currently, when a string type is used as the primary key, an implicit rowid is generated as the actual primary key. I would like to understand the reasons and considerations for not using the string type as the actual primary key. By the way, in the current implementation, I understand that performing a group by on a string type will have significant performance overhead. If the string type is set as the primary key, would this issue no longer exist?

| username: tidb狂热爱好者 | Original post link

Using characters as primary keys has significant performance overhead. UTF8MB4 uses 4 bytes per character, so a 64-character key would be a 256-byte string for group by.

| username: tidb狂热爱好者 | Original post link

The performance is too poor.

| username: llllllll | Original post link

In the case of using varchar as the primary key, will the implicit rowid and the set varchar primary key or composite primary key maintain a certain mapping relationship, or are they completely unrelated?

| username: llllllll | Original post link

In the case of using varchar or multiple columns combined as a primary key, will the implicit rowid and the set varchar primary key or combined primary key maintain a certain mapping relationship, or are they completely unrelated?

| username: 啦啦啦啦啦 | Original post link

There is a mapping relationship.
I suggest watching the video course on TiDB database table structure design.
https://learn.pingcap.com/learner/course/120005

| username: llllllll | Original post link

I can’t watch this video, and the content is a bit much. Is there any related documentation available to read?

| username: Billmay表妹 | Original post link

This video is available for a limited time and can be watched~

| username: llllllll | Original post link

After reading the relevant documentation, it seems that the value of rowid has nothing to do with the primary key, but is only related to the auto_increment attribute. Is this correct?

| username: 啦啦啦啦啦 | Original post link

If there is no relationship, how do you perform KV mapping?

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.