Skip to content

[Exploring] De-duplicate Search Parame#5557

Open
mikaelweave wants to merge 1 commit intomainfrom
personal/mikaelw/deduplicate-repeated-search
Open

[Exploring] De-duplicate Search Parame#5557
mikaelweave wants to merge 1 commit intomainfrom
personal/mikaelw/deduplicate-repeated-search

Conversation

@mikaelweave
Copy link
Copy Markdown
Contributor

Description

Deduplicate when the exact same search param is passed in

Related issues

Addresses [issue #].

Testing

Describe how this change was tested.

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • When changing or adding behavior, if your code modifies the system design or changes design assumptions, please create and include an ADR.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@mikaelweave mikaelweave requested a review from a team as a code owner May 7, 2026 20:02
…licate SQL CTEs

Exact duplicate query parameter tuples (same name and value) produced
repeated identical AND predicates in SearchOptionsFactory. Each one was
then turned into its own SQL Server CTE, causing long-running queries
with chains of identical TokenSearchParam CTEs.

Traced via Kusto to trace 245ef4e9db69c79786556e0504351e37 on pod
hb3xt9mi7kd1w995ks9mp2yhj, a batch subrequest with Resource-tag
repeated 13 times, resulting in 11 identical CTEs for SearchParamId 1218.

Fix: apply Distinct() on the Parameters collection before parsing
expressions. Preserves repeated same-name/different-value semantics
(e.g. _tag=a&_tag=b) while collapsing exact duplicates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mikaelweave mikaelweave force-pushed the personal/mikaelw/deduplicate-repeated-search branch from 12f5427 to 176364e Compare May 7, 2026 20:12
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.37%. Comparing base (6faa795) to head (176364e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5557      +/-   ##
==========================================
- Coverage   77.63%   77.37%   -0.27%     
==========================================
  Files         985      985              
  Lines       36189    36189              
  Branches     5498     5498              
==========================================
- Hits        28097    28000      -97     
- Misses       6738     6837      +99     
+ Partials     1354     1352       -2     

see 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mikaelweave mikaelweave changed the title [Do Not Review] De-duplicate Search Parame [Exploring] De-duplicate Search Parame May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants