diff --git a/CHANGELOG.md b/CHANGELOG.md index 65468d5bac..9c4ac89757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,14 @@ - - - - # Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [8.3.1] - Unreleased + +- Improve Performance of regenerating problems with child providers + ## [8.3.0] - 2024-09-23 - Add New Find & Replace, currently available via User Settings diff --git a/Rdmp.Core/Providers/CatalogueProblemProvider.cs b/Rdmp.Core/Providers/CatalogueProblemProvider.cs index bddd8bd3eb..fcb7522c4b 100644 --- a/Rdmp.Core/Providers/CatalogueProblemProvider.cs +++ b/Rdmp.Core/Providers/CatalogueProblemProvider.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.Linq; using Rdmp.Core.CommandExecution.AtomicCommands; @@ -43,18 +44,13 @@ public override void RefreshProblems(ICoreChildProvider childProvider) _childProvider = childProvider; //Take all the catalogue items which DON'T have an associated ColumnInfo (should hopefully be quite rare) - var orphans = _childProvider.AllCatalogueItems.Where(ci => ci.ColumnInfo_ID == null); - - //now identify those which have an ExtractionInformation (that's a problem! they are extractable but orphaned) - _orphanCatalogueItems = new HashSet( - orphans.Where(o => _childProvider.AllExtractionInformations.Any(ei => ei.CatalogueItem_ID == o.ID)) - - //store just the ID for performance - .Select(i => i.ID)); - + var catalogueIDs = _childProvider.AllCatalogueItems.Where(ci => ci.ColumnInfo_ID == null).Select(i => i.ID).ToList(); + var extractionInfoIDs = _childProvider.AllExtractionInformations.Select(ei => ei.CatalogueItem_ID).ToList(); + var orphans = catalogueIDs.Intersect(extractionInfoIDs); + _orphanCatalogueItems = orphans.ToHashSet(); _usedJoinables = new HashSet( - childProvider.AllJoinableCohortAggregateConfigurationUse.Select( - ju => ju.JoinableCohortAggregateConfiguration_ID)); + childProvider.AllJoinableCohortAggregateConfigurationUse.Select( + ju => ju.JoinableCohortAggregateConfiguration_ID)); _joinsWithMismatchedCollations = childProvider.AllJoinInfos.Where(j => !string.IsNullOrWhiteSpace(j.PrimaryKey.Collation) &&