Skip to content

Noisy messages for index histogram #63880

Closed

Description

@dveeden

Bug Report

Noisy messages like this:

{
  "level": "WARN",
  "time": "2025/10/08 18:10:37.342 +00:00",
  "caller": "stats_syncload.go:415",
  "message": "fail to get hist meta for this histogram, possibly a deleted one",
  "table_id": 1039,
  "hist_id": 2,
  "is_index": true
}

This happens for multiple table_id's and multiple hist_id's, but is_index is always true.

It looks like mysql.stats_histograms doesn't have an entry for the table_id/hist_id/is_index combination.

The message seems to repeat with the same properties.

This seems similar to:

1. Minimal reproduce step (Required)

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

v8.5.2

Activity

  1. 0xPoe commented on Oct 14, 2025

    @0xPoe
    Member

    The reproduction step:

    1. Turn off the auto analyze:
    set global tidb_enable_auto_analyze = false;
    1. Create a table and insert some data:
    set @@cte_max_recursion_depth=10000;
    use test;
    create table h (idx int, code int, typ1 int, typ2 int, update_time int, key k1(idx, typ1, typ2), key k2(idx, update_time));
    insert into h select * from (
      with recursive tt as (
        select 0 idx, 0 as code, 0 as typ1, 0 as typ2, 0 as update_time
        union all
        select mod(update_time, 100) as idx, 0 as code, 0 as typ1, 0 as typ2, update_time+1 as update_time from tt where update_time<5000
      ) select * from tt
    ) tt;
    1. Analyze the table and explain to check the stats status:
    analyze table h;
    explain select * from h where idx = 0;
    1. Add a new index:
    ALTER TABLE h ADD INDEX k3(code);
    explain select * from h where code = 0;
    1. Check logs:
    [2025/10/14 12:49:01.140 +02:00] [WARN] [stats_syncload.go:416] ["fail to get hist meta for this histogram, possibly a deleted one"] [table_id=110] [hist_id=3] [is_index=true]
    
  2. 0xPoe commented on Oct 14, 2025

    @0xPoe
    Member

    I think we should make the error message clearer and use a sample logger to reduce the amount of logs.

  3. 0xPoe commented on Oct 14, 2025

    @0xPoe
    Member

    The load behavior is expected, but it’s just too overwhelming.

    There are some subtle differences between the master branch and 8.5.2. Further investigation is needed.

  4. 0xPoe commented on Oct 16, 2025

    @0xPoe
    Member

    On 8.5.2, I can confirm that the issue is from here:

    Image

    The checked field is always false.

    The reason the checked field is always false is that the lite init stats process never sets this field. Additionally, during the stats update process, there are no updates after the last histogram version, so the columns’ and indexes’ statistics are never checked. As a result, this field remains false.

  5. dveeden commented on Oct 16, 2025

    @dveeden
    ContributorAuthor

    What about v8.5.3, does that have the same issue?

  6. 0xPoe commented on Oct 16, 2025

    @0xPoe
    Member

    I have confirmed that this issue still exists even in the latest release-8.5 branch.

  7. 0xPoe commented on Oct 16, 2025

    @0xPoe
    Member

    For the master branch, I believe this issue still existed before we merged PR #63626.

  8. added a commit that references this issue on Oct 21, 2025
    ce9f4c6
  9. added a commit that references this issue on Nov 26, 2025
    ac50827
  10. added a commit that references this issue on Dec 5, 2025
    4dbacbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions