Skip to content

Slow Table List Retrieval in Many Tables #589

@mrchypark

Description

@mrchypark

Description

We are currently managing a large number of tables (964) in our database, with expectations for continued growth. We've encountered a significant performance issue when attempting to retrieve the list of tables using the SELECT * FROM information_schema.tables query. This operation is taking over 30 seconds to complete, which is causing concerns about efficiency and scalability.

Context

  • Current number of tables: 964
  • Expected: Continued growth in the number of tables
  • Current behavior: DROP TABLE and CREATE TABLE operations do not support IF NOT EXISTS or IF EXISTS clauses
  • Workaround attempt: Using SELECT * FROM information_schema.tables to check table existence
  • Problem: This query is taking more than 30 seconds to execute

Impact

The slow retrieval of the table list is affecting our ability to efficiently manage and operate on our database schema. This issue may become more severe as we continue to add more tables to the database.

Questions for Investigation

  1. Is this query performance normal for the given number of tables?
  2. Are there any optimizations we can apply to the information_schema.tables query to improve its performance?
  3. Can we implement support for IF NOT EXISTS and IF EXISTS clauses in our CREATE TABLE and DROP TABLE operations to avoid the need for this query?
  4. Are there any index optimizations we can apply to improve the performance of metadata queries?
  5. Is there an alternative method to efficiently check for table existence without querying the entire table list?
  6. How does this query performance scale with an increasing number of tables?

Additional Information

  • While other queries are running concurrently, the time taken for retrieving the table list seems disproportionately long.
  • We need to find a solution that scales well as our database continues to grow.

Next Steps

We would appreciate insights from the team on:

  1. Potential causes of this performance issue
  2. Recommended approaches for investigation
  3. Possible solutions or optimizations to improve the table list retrieval performance

Any additional context or suggestions for improving our database management approach would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions