Repository navigation
turbostats: a database counts its tables and its partitions - #452
Merged
Merged
Conversation
A database section said how big the database is, but not how many tables it holds. A table partitioned by day adds a partition a day until retention drops one. When retention stops, the partition count climbs before the disk does, and nothing reported it. Control's own database holds 172 tables, 148 of them partitions under 10 parents. DatabaseResources sends table_count, the tables in the database's own schemas with partitions included, and partition_count, how many of them are partitions. Both are optional: a kind that cannot count its tables leaves both out. One round-trip test, which fails to build without the fields. The widest database bundle grows 54 bytes, to 84,091, under the 128 KiB a receiver allows. The schema is regenerated. If this is wrong, a receiver misreads the two counts. Both fields are new and optional, so a receiver that does not know them ignores them, and every existing field is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DatabaseResourcesgains two optional fields:table_count: the tables in the database's own schemas, partitions included. System catalogs are not counted.partition_count: how many of those tables are partitions.Why
A table partitioned by day adds a partition each day until retention drops one. If retention stops, the partition count climbs before the disk fills, and no report showed it. Control's own database holds 172 tables, 148 of them partitions under 10 parents.
Tests
TestDatabaseResources_TableAndPartitionCountsRoundTripfails to build without the fields. It also checks that a kind that cannot count its tables leaves both fields out.make schemaregeneratedbundle.schema.json.turbostats/wirepassesvetandtest.After merge
dbhealth pins this commit and sends the counts. Control pins it, stores the counts in
database_reports, and shows them on the database page.