Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TiDB的INFORMATION_SCHEMA数据库的DDL_JOBS表的疑问
The DDL_JOBS table has two fields, DB_NAME and SCHEMA_ID. These two fields should have a one-to-one relationship. Where exactly is the mapping relationship between these two fields stored? Logically, the mapping relationship between the database name and the database ID should be stored in SCHEMATA, but I haven’t found it.
I checked all the fields with id and couldn’t find it.
I find it very strange, there shouldn’t be such an issue. I believe SCHEMA_ID should exist in the SCHEMATA table.
TABLE_ID exists in the TABLES table, and here the official TiDB records this field as TIDB_TABLE_ID.
The concept of schema is inherently weakened, and currently, only the DDL_JOBS table shows the SCHEMA_ID field.
This mapping relationship should be a fundamental piece of data, right? Even if it’s a weakened concept, it should still exist, shouldn’t it?
Yes, it definitely exists, but it doesn’t necessarily need to be displayed. You can ask the experts for more details. Currently, I don’t have a need to use the SCHEMA_ID field.
Let’s put this aside for now and study other technologies. This is not commonly used in normal usage. The scheme_name basically satisfies all queries and associations.
If it’s a new requirement, you can go to: 产品需求 - TiDB 的问答社区 to submit it~
Indeed, it doesn’t exist explicitly. I couldn’t find it either.
Let’s assume there is a scenario where I delete a database and then create a new database with the same schema_name. Without an ID, how can I distinguish that they are different databases?
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.