TD-7613 competency data services query optimisation - #3720
Open
kevwhitt-hee wants to merge 6 commits into
Open
Conversation
- Replaced scalar subqueries in self-assessment base fields with LEFT JOINs for Brands, CourseCategories, SelfAssessments, AdminUsers, and NRP lookup tables. - Simplified UpdateCompetencyRoleProfileLinks to do one conditional update instead of a prior count query. - Rewrote GetCollaboratorNotification to avoid redundant scalar lookups and fix the malformed SQL. - Changed HasCompetencyWithSignpostedLearning to SELECT TOP(1) 1 instead of COUNT(*).
…y if data input is empty
GetDashboardDataForAdminId Fixed hardcoded sd.SupervisorAdminID = 10857 to use @AdminID GetAvailableCompetencyAssessmentsForDelegate Replaced correlated scalar subqueries with LEFT JOIN lookups for Brand, NRPProfessionalGroup, NRPSubGroup, and NRPRole Replaced NOT IN with NOT EXISTS for better SARGability GetCompetencyAssessmentById Replaced scalar subqueries with LEFT JOIN lookups for the related metadata fields ValidateDelegate Combined the two-step delegate validation into a single query AddSuperviseDelegate Cleaned up the SELECT COALESCE(...) query and fixed malformed SQL/C# syntax Improved null-parameter handling
Replaced repeated/nested scalar subqueries with joins Added a safe IN @competencyIds parameterized query for GetSelectedCompetencyFlagsByCompetecyIds Reworked GetCompetencyResourceAssessmentQuestionParameterByCompetencyLearningResourceId to return null cleanly when no resource is found and avoid string interpolation for SQL IN clauses Made GetBaseFrameworkByFrameworkId / GetBrandedFrameworkByFrameworkId nullable return types consistent
Simplified AddCompetencyLearningResource Replaced IF NOT EXISTS + repeated lookup with a single SELECT TOP 1 ID Improved the insert/upsert logic making it cheaper Improved GetCompetencyResourceAssessmentQuestionParameters by adding an empty-list check before executing the IN @resourceIds query to avoid errors/handling empty inputs
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
JIRA link
TD-7613
Description
In-place optimisations for queries across the data services relating to the competency framework service. These largely involve:
No functional changes have been made; method signatures and return objects all remain the same (although a few have been made nullable deliberately). Developer testing has confirmed continued, like-for-like function and, in most cases, observable performance improvements.
Developer checks
(Leave tasks unticked if they haven't been appropriate for your ticket.)
I have:
Either:
Or: