Optimization of tidb auto_random and ttl settings

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

Original topic: tidb auto_random和ttl设置优化

| username: TI表弟

After executing the statement following “show create table” to create a new table in TiDB, both auto_random and ttl did not take effect.

| username: Billmay表妹 | Original post link

Please post the reproduction steps. There’s only one sentence, and it’s unclear what it is.

| username: TI表弟 | Original post link

Neither TTL nor auto_rand took effect when creating the new table.

| username: TI表弟 | Original post link

Cousin, did I make myself clear?

| username: 大飞哥online | Original post link

Show the table structure.

| username: forever | Original post link

When executing the command line, add -c to log in, otherwise the /**/ will be treated as a comment.

| username: 小龙虾爱大龙虾 | Original post link

As mentioned above, the MySQL client needs to log in with the -c option so that comments are sent to the server, or you can simply avoid writing comments.

| username: zhanggame1 | Original post link

–comments Whether to strip or retain comments in the statements sent to the server. The default value is --skip-comments.

| username: TI表弟 | Original post link

Got it.

| username: TI表弟 | Original post link

Thank you all, I already have the answer. Thank you very much.

| username: 江湖故人 | Original post link

TiDB executable comment syntax. It is mainly divided into two types:

  • /*T! Specific code */: This syntax can only be parsed and executed by TiDB, while it will be ignored in other databases.
  • /*T![feature_id] Specific code */: This syntax is used to ensure compatibility between different versions of TiDB. Only the TiDB version that has implemented the feature corresponding to feature_id will attempt to parse the SQL fragment within the comment. For example, the AUTO_RANDOM feature was introduced in v3.1.1, and this version can parse /*T![auto_rand] auto_random */ as auto_random; whereas in v3.0.0, which does not have the AUTO_RANDOM feature, the above SQL fragment will be ignored. Note that there are no spaces between the characters in /*T![.

Comment Syntax | PingCAP Documentation Center

| username: TI表弟 | Original post link

Indeed, impressive.

| username: system | Original post link

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