This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
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.
Description
prom_info.metric
can be quite slow. Part of this is due to the columns that deal with disk size. Split the view into two views - one that does not have the size columns and is optimized for speed, and the original.prom_info.metric
is now a SQL view (not backed by a function) and it omits the columns dealing with disk size. On a test database containing 2,500 metrics and 1.5 million chunks, it returned in ~4 seconds whereas the original was killed after running for > 20 minutes.prom_info.metric_detail
is a view that is backed by a function (_prom_catalog.metric_detail
) which has the same signature as the original view. i.e. it contains the columns dealing with disk size. If this is a multinode installation (which we don't currently even support), it executes the original query. If this is a singlenode installation (which should be everyone), we use a new optimized query.The new
prom_info.metric_detail
returns in 2.5 minutes on a test system with 2,500 metrics and 1.5 million chunks.Merge requirements
Please take into account the following non-code changes that you may need to make with your PR: