Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change query generator to use INNER JOIN #3572

Merged
merged 2 commits into from
Nov 2, 2023

Conversation

feordin
Copy link
Contributor

@feordin feordin commented Oct 27, 2023

Description

Update the SQL Query generator to use INNER JOIN instead of EXISTS when joining CTEs. This dramatically reduces the overhead for SQL to create the query plan.

Related issues

Addresses [issue AB#105397].

Testing

Manual testing file of the customer's reported failing query was created and used as a guide. The failure to generate the query plan was observed locally.

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.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@feordin feordin added Bug-Performance Performance related bugs. Area-SQL Area related to the SQL Server data provider Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs labels Oct 27, 2023
@feordin feordin added this to the S126 milestone Oct 27, 2023
@feordin feordin requested a review from a team as a code owner October 27, 2023 03:16
@feordin feordin changed the title Change query generator to use INNER JOIN instead of EXISTS in more cases Change query generator to use INNER JOIN Oct 27, 2023
Copy link
Contributor

@mikaelweave mikaelweave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment on code and questions on the REST file.

Copy link
Contributor

@mikaelweave mikaelweave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an expert in this area but looks good to me. Approved assuming expert isn't needed.

docs/rest/complexQueries.http Show resolved Hide resolved
@feordin feordin merged commit 197c2ad into main Nov 2, 2023
6 checks passed
@feordin feordin deleted the personal/jaerwin/sql-exec-plan branch November 2, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-SQL Area related to the SQL Server data provider Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Bug-Performance Performance related bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants