Skip to content

Commit

Permalink
Run UPDATE STATISTICS on codeset table. (#197)
Browse files Browse the repository at this point in the history
Fixes #192.
  • Loading branch information
chrisknoll authored Aug 25, 2023
1 parent fa4391b commit f37f535
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public String getCodesetQuery(ConceptSet[] conceptSets) {
String queryWithInsert = StringUtils.replace(
CODESET_QUERY_TEMPLATE,
"@codesetInserts",
"INSERT INTO #Codesets (codeset_id, concept_id)\n" + unionSelectsQuery
"INSERT INTO #Codesets (codeset_id, concept_id)\n" + unionSelectsQuery + ";"
);
return queryWithInsert + ";";
return queryWithInsert;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ CREATE TABLE #Codesets (
;

@codesetInserts

UPDATE STATISTICS #Codesets;
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void getCodesetQueryEmptyConceptSets() {
assertThat(codesetQuery, equalTo("CREATE TABLE #Codesets (\n" +
" codeset_id int NOT NULL,\n" +
" concept_id bigint NOT NULL\n" +
")\n;\n\n\n"));
")\n;\n\n\n\nUPDATE STATISTICS #Codesets;\n"));
}

@Test
Expand All @@ -53,7 +53,7 @@ public void getCodesetQueryNullConceptSets() {
assertThat(codesetQuery, equalTo("CREATE TABLE #Codesets (\n" +
" codeset_id int NOT NULL,\n" +
" concept_id bigint NOT NULL\n" +
")\n;\n\n\n"));
")\n;\n\n\n\nUPDATE STATISTICS #Codesets;\n"));
}

private ConceptSet createConceptSet(int id, String name) {
Expand Down

0 comments on commit f37f535

Please sign in to comment.