Commits on Source (4)
-
Sami Hiltunen authored
The dataloss query is extremely slow for bigger datasets. The problem is that for each row that the data loss query is returning, Postgres computes the full result of the valid_primaries view only to filter down to the correct record. This results in an o(n2) complexity which kills the performance as soon as the dataset size increases. It's not clear why the join parameters are not pushed down in to the view in the query. This commit optimizes the query by materializing the valid_primaries view. This ensures Postgres computes the full view only once and joins with the pre-computed result. Changelog: performance
-
Sami Hiltunen authored
Dataloss query is currently getting the latest generation of a repository from a view that takes the max generation from storage_repositories. This is unnecessary as the repositories table already contains the latest generation and we can take it from there instead. This commit reads it from the repositories table instead. Changelog: performance
-
Sami Hiltunen authored
RepositoryStoreCollector gathers metrics on repositories which don't have a valid primary candidates available. This indicates the repository is unavailable as the current primary is not valid and ther are no valid candidates to failover to. The query is currently extremely inefficient on some versions of Postgres as it ends up computing the full valid_primaries view for each of the rows it checks. This doesn't seem to occur on all versions of Postgres, namely 12.6 at least manages to push down the search criteria inside the view. This commit fixes the situation by materializing the valid_primaries view prior to querying it. This ensures the full view isn't computed for all of the rows but rather Postgres just uses the pre-computed result. Changelog: performance
-
Toon Claes authored
Materialize valid_primaries view (14.4) See merge request !4090
Showing
- internal/praefect/datastore/collector.go 5 additions, 0 deletionsinternal/praefect/datastore/collector.go
- internal/praefect/datastore/repository_store.go 5 additions, 2 deletionsinternal/praefect/datastore/repository_store.go
- internal/praefect/datastore/repository_store_test.go 10 additions, 3 deletionsinternal/praefect/datastore/repository_store_test.go