Skip to content

Commit

Permalink
Improve search queries by better indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuomo Ala-Vannesluoma committed Oct 4, 2021
1 parent d320b78 commit d842f8f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
@UniqueConstraint(name = "IDX_SEARCH_UUID", columnNames = "SEARCH_UUID")
}, indexes = {
@Index(name = "IDX_SEARCH_RESTYPE_HASHS", columnList = "RESOURCE_TYPE,SEARCH_QUERY_STRING_HASH,CREATED"),
@Index(name = "IDX_SEARCH_CREATED", columnList = "CREATED")
@Index(name = "IDX_SEARCH_CREATED", columnList = "CREATED"),
@Index(name = "IDX_SEARCH_DELETED", columnList = "SEARCH_DELETED")
})
public class Search implements ICachedSearchDetails, Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

//@formatter:off
@Entity
@Table(name = "HFJ_SEARCH_INCLUDE")
@Table(name = "HFJ_SEARCH_INCLUDE", indexes = {
@Index(name = "IDX_SEARCH_INCLUDE_SEARCH_PID", columnList = "SEARCH_PID")
})
//@formatter:on
public class SearchInclude implements Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ public HapiFhirJpaMigrationTasks(Set<String> theFlags) {
init530();
init540(); // 20210218 - 20210520
init550(); // 20210520 -
init560(); // 20210921 -
}

private void init560() {
Builder version = forVersion(VersionEnum.V5_6_0);

Builder.BuilderWithTableName searchTable = version.onTable("HFJ_SEARCH");
searchTable.addIndex("20210921.1", "IDX_SEARCH_DELETED").unique(false).withColumns("SEARCH_DELETED");

Builder.BuilderWithTableName searchIncludeTable = version.onTable("HFJ_SEARCH_INCLUDE");
searchIncludeTable.addIndex("20210921.2", "IDX_SEARCH_INCLUDE_SEARCH_PID").unique(false).withColumns("SEARCH_PID");
}

private void init550() {
Expand Down

0 comments on commit d842f8f

Please sign in to comment.