Add res_id, and partition_id to string norm and exact indexes (#3569)
Add res_id, and partition_id to string norm and exact indexes to avoid random row reads.
This commit is contained in:
parent
10ebb082d0
commit
06030094c8
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
type: change
|
||||
issue: 3569
|
||||
title: "The normalized and exact string database indexes have been changed to provide faster string searches."
|
|
@ -301,6 +301,33 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
.onTable("HFJ_RESOURCE")
|
||||
.dropIndexOnline("20220425.2", "IDX_RES_TYPE");
|
||||
}
|
||||
|
||||
/**
|
||||
* Update string indexing
|
||||
* @see ca.uhn.fhir.jpa.search.builder.predicate.StringPredicateBuilder
|
||||
* @see ResourceIndexedSearchParamString
|
||||
*/
|
||||
{
|
||||
Builder.BuilderWithTableName tokenTable = version.onTable("HFJ_SPIDX_STRING");
|
||||
|
||||
// add res_id, and partition_id so queries are covered without row-reads.
|
||||
tokenTable
|
||||
.addIndex("20220428.1", "IDX_SP_STRING_HASH_NRM_V2")
|
||||
.unique(false)
|
||||
.online(true)
|
||||
.withColumns("HASH_NORM_PREFIX", "SP_VALUE_NORMALIZED", "RES_ID", "PARTITION_ID");
|
||||
tokenTable.dropIndexOnline("20220428.2", "IDX_SP_STRING_HASH_NRM");
|
||||
|
||||
tokenTable
|
||||
.addIndex("20220428.3", "IDX_SP_STRING_HASH_EXCT_V2")
|
||||
.unique(false)
|
||||
.online(true)
|
||||
.withColumns("HASH_EXACT", "RES_ID", "PARTITION_ID");
|
||||
tokenTable.dropIndexOnline("20220428.4", "IDX_SP_STRING_HASH_EXCT");
|
||||
|
||||
// we will drop the updated column. Start with the index.
|
||||
tokenTable.dropIndexOnline("20220428.5", "IDX_SP_STRING_UPDATED");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,10 +59,9 @@ import static org.apache.commons.lang3.StringUtils.defaultString;
|
|||
// This is used for sorting, and for :contains queries currently
|
||||
@Index(name = "IDX_SP_STRING_HASH_IDENT", columnList = "HASH_IDENTITY"),
|
||||
|
||||
@Index(name = "IDX_SP_STRING_HASH_NRM", columnList = "HASH_NORM_PREFIX,SP_VALUE_NORMALIZED"),
|
||||
@Index(name = "IDX_SP_STRING_HASH_EXCT", columnList = "HASH_EXACT"),
|
||||
@Index(name = "IDX_SP_STRING_HASH_NRM_V2", columnList = "HASH_NORM_PREFIX,SP_VALUE_NORMALIZED,RES_ID,PARTITION_ID"),
|
||||
@Index(name = "IDX_SP_STRING_HASH_EXCT_V2", columnList = "HASH_EXACT,RES_ID,PARTITION_ID"),
|
||||
|
||||
@Index(name = "IDX_SP_STRING_UPDATED", columnList = "SP_UPDATED"),
|
||||
@Index(name = "IDX_SP_STRING_RESID", columnList = "RES_ID")
|
||||
})
|
||||
public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchParam {
|
||||
|
|
Loading…
Reference in New Issue