Questions about the DDL_JOBS Table in the INFORMATION_SCHEMA Database of TiDB

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

Original topic: TiDB的INFORMATION_SCHEMA数据库的DDL_JOBS表的疑问

| username: TIDB救我狗命

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.

| username: forever | Original post link

I checked all the fields with id and couldn’t find it. :joy:

| username: TIDB救我狗命 | Original post link

I find it very strange, there shouldn’t be such an issue. I believe SCHEMA_ID should exist in the SCHEMATA table.

| username: TIDB救我狗命 | Original post link

TABLE_ID exists in the TABLES table, and here the official TiDB records this field as TIDB_TABLE_ID.

| username: ShawnYan | Original post link

The concept of schema is inherently weakened, and currently, only the DDL_JOBS table shows the SCHEMA_ID field.

| username: TIDB救我狗命 | Original post link

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?

| username: ShawnYan | Original post link

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.

| username: forever | Original post link

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.

| username: Billmay表妹 | Original post link

If it’s a new requirement, you can go to: 产品需求 - TiDB 的问答社区 to submit it~

| username: xiaohetao | Original post link

Indeed, it doesn’t exist explicitly. I couldn’t find it either.

| username: TIDB救我狗命 | Original post link

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?

| username: system | Original post link

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