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

Views or dictionaries should not count towards AttachedTable events #64137

Closed
Algunenano opened this issue May 20, 2024 · 2 comments
Closed

Views or dictionaries should not count towards AttachedTable events #64137

Algunenano opened this issue May 20, 2024 · 2 comments
Assignees

Comments

@Algunenano
Copy link
Member

Currently we warn if a server has too many tables (The number of attached tables is more than 5000).

The default limit is a recommendation based on the resource usage that tables would have in the system, which is some kind of obscure value but it's much better than not having anything.

The problem is that we are counting everything as a table. For example:

SELECT
FROM system.metrics
WHERE name = 'AttachedTable'

   ┌─metric────────┬─value─┬─description─────────────────────────────────────────┐
1. │ AttachedTable │  5646 │ Active table, used by current and upcoming SELECTs. │
   └───────────────┴───────┴─────────────────────────────────────────────────────┘

SELECT
    engine,
    count()
FROM system.tables
WHERE database NOT IN ('system', 'information_schema', 'INFORMATION_SCHEMA')
GROUP BY ALL
    WITH TOTALS
ORDER BY count() ASC

   ┌─engine─────────────────────┬─count()─┐
1. │ SharedReplacingMergeTree   │       1 │
2. │ SharedAggregatingMergeTree │      12 │
3. │ MaterializedView           │      15 │
4. │ SharedMergeTree            │    1053 │
5. │ View                       │    4392 │
   └────────────────────────────┴─────────┘

We should treat and count views (and I think dictionaries) differently as the expected resource usage is completely different than a replicated table, for example. They should have a different count and message if necessary

@Beetelbrox
Copy link
Contributor

Beetelbrox commented May 21, 2024

Hallo! I'd like to give this issue a shot, I'm working on a PR (WIP here)

@Algunenano
Copy link
Member Author

Implemented in #64180

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

No branches or pull requests

2 participants