From a18c83ae1359a91861ff078b6280d59aa6d13ebf Mon Sep 17 00:00:00 2001 From: JasonRoberts-smile <85363818+JasonRoberts-smile@users.noreply.github.com> Date: Fri, 17 Jun 2022 12:10:21 -0400 Subject: [PATCH] replace UNION with UNION ALL in chained search query (#3715) --- .../6_1_0/3714-improve-chained-search-performance.yaml | 4 ++++ .../main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3714-improve-chained-search-performance.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3714-improve-chained-search-performance.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3714-improve-chained-search-performance.yaml new file mode 100644 index 00000000000..18e792d33e6 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3714-improve-chained-search-performance.yaml @@ -0,0 +1,4 @@ +type: perf +issue: 3714 +jira: SMILE-4484 +title: "Chained searches have been sped up for configurations where the `Index Contained Resources` feature is enabled." diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java index e44556518be..4c8b1363b06 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java @@ -933,7 +933,7 @@ public class QueryStack { EnumSet cachedReusePredicateBuilderTypes = EnumSet.copyOf(myReusePredicateBuilderTypes); myReusePredicateBuilderTypes.clear(); - UnionQuery union = new UnionQuery(SetOperationQuery.Type.UNION); + UnionQuery union = new UnionQuery(SetOperationQuery.Type.UNION_ALL); ReferenceChainExtractor chainExtractor = new ReferenceChainExtractor(); chainExtractor.deriveChains(theResourceName, theSearchParam, theList);