Issues Related to Table Statistics After Data Restoration Using BR

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

Original topic: 通过br 恢复数据后,表的统计信息相关问题

| username: Raymond

After restoring data using BR, the table’s statistics are found to be missing. For example, querying information_schema.tables shows data_length and table_rows both as 0. Has anyone encountered this issue?

| username: ddhe9527 | Original post link

By default, BR does not back up the MySQL database. After you perform a full backup with BR and then delete the table, the statistics under the MySQL database are also gone. When you restore it with BR, the table data comes back, but the statistics are zero and need to be recollected.

| username: 箱子NvN | Original post link

The expert above is right, BR does not back up the MySQL database. I have done something similar; I deleted a few tables under the MySQL database, and then I couldn’t recover them. :rofl:

| username: ealam_小羽 | Original post link

BR backs up the mysql database depending on the version, and restoring the mysql database is an experimental feature that is currently not fully developed.

| username: cs58_dba | Original post link

The MySQL database can only be logically exported and imported using Dumpling or Mydumper.

| username: ShawnYan | Original post link

The reason is that although backup and restore of system tables are supported, statistics are not restored during the restoration process. For more details, you can refer to: backup,restore: support backing up / restore system databases by YuJuncen · Pull Request #1048 · pingcap/br · GitHub

But this doesn’t allow restore stats – because the table IDs of the stats backed up are old table IDs, we need more efforts to rewrite them to make them take effect after the restoration.

| username: 箱子NvN | Original post link

Thank you, master!! I learned a lot :kissing_heart:

| username: system | Original post link

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