Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement In-Memory Priority Queue for Auto-Analyze #55906

Open
1 of 27 tasks
Rustin170506 opened this issue Sep 6, 2024 · 0 comments
Open
1 of 27 tasks

Implement In-Memory Priority Queue for Auto-Analyze #55906

Rustin170506 opened this issue Sep 6, 2024 · 0 comments
Labels
component/ddl This issue is related to DDL of TiDB. component/statistics type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@Rustin170506
Copy link
Member

Rustin170506 commented Sep 6, 2024

Overview

Implement a new priority queue that maintains a heap in memory to improve performance and reduce the overhead of rebuilding the queue for auto-analyze operations.

Goals

  • Avoid scanning the table information every time
  • Reflect DDL changes in the priority queue
  • Ensure DDL events are received with correct reliability and order

Tasks

  1. Implement basic heap structure with thread-safe operations
  2. Implement DML change handling
    • Incremental updates from stats cache
    • Score recalculation based on modify_count and count changes
  3. Implement DDL change handling
    • Create mysql.ddl_notifier table
    • Implement DDLNotifier for fetching and delivering DDL events
    • Implement subscription mechanism for DDL events
  4. Implement time-based updates for analysis intervals
  5. Implement failover handling
    • Priority queue rebuild after node restart
    • Priority queue rebuild after owner switch
  6. Implement test suite
    • Functional tests
    • Scenario tests
    • Benchmark tests

Performance Considerations

  • Optimize memory usage of in-memory priority queue
  • Benchmark performance with large number of tables (1 million+)
  • Measure performance of handling large number of DDL events
  • Optimize priority queue rebuild process

Documentation

  • Update design document with final implementation details
  • Create user documentation for new auto-analyze behavior
  • Update developer documentation with new priority queue implementation

Related PRs

Unresolved Questions

  • Determine most efficient method for looking up table IDs with updates (query mysql.stats_meta vs. querying stats cache)
@Rustin170506 Rustin170506 added type/feature-request Categorizes issue or PR as related to a new feature. component/statistics component/ddl This issue is related to DDL of TiDB. labels Sep 6, 2024
ti-chi-bot bot pushed a commit that referenced this issue Sep 14, 2024
ti-chi-bot bot pushed a commit that referenced this issue Sep 24, 2024
ti-chi-bot bot pushed a commit that referenced this issue Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ddl This issue is related to DDL of TiDB. component/statistics type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant