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

BaseShowTablesWithSizes: poor performance for MySQL 8.0 with thousands of tables #13374

Closed
shlomi-noach opened this issue Jun 25, 2023 · 1 comment · Fixed by #13375
Closed

Comments

@shlomi-noach
Copy link
Contributor

When the keyspace has thousands of tables, the tablet server engine takes a logs time to load. Measured numbers: about 10secfor4000` tables. The number can vary by machine type and tablet definitions.

The query is:

const TablesWithSize80 = `SELECT t.table_name,
t.table_type,
UNIX_TIMESTAMP(t.create_time),
t.table_comment,
SUM(i.file_size),
SUM(i.allocated_size)
FROM information_schema.tables t
LEFT JOIN information_schema.innodb_tablespaces i
ON i.name LIKE CONCAT(database(), '/%') AND (i.name = CONCAT(t.table_schema, '/', t.table_name) OR i.name LIKE CONCAT(t.table_schema, '/', t.table_name, '#p#%'))
WHERE t.table_schema = database()
GROUP BY t.table_name, t.table_type, t.create_time, t.table_comment`

The query can be optimized. Followup in a PR.

@shlomi-noach
Copy link
Contributor Author

#13375 addresses this issue. Query time drops from 10s to some 0.2s or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant