Add upgrade notes for upgrading SearchParameter indexing offline (#3666)

Add upgrade notes to support upgrading SearchParameter database indexing.
This commit is contained in:
michaelabuckley 2022-06-02 11:46:34 -04:00 committed by GitHub
parent a3de219a1e
commit 72823b730d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 333 additions and 2 deletions

View File

@ -1,5 +1,7 @@
This release has some breaking changes that are worth knowing about.
* Hibernate Search mappings for Terminology entities have been upgraded, which causes a reindex of ValueSet resources to be required.
This release has breaking changes, and some large database changes.
* Hibernate Search mappings for Terminology entities have been upgraded, which requires a reindex of ValueSet resources.
* Database SearchParameter indexes have been redefined.
This stage of the upgrade may be slow, and can be scheduled before the main upgrade window.
## Hibernate Search Mappings Upgrade
@ -26,3 +28,332 @@ Content-Type: application/fhir+json
} ]
}
```
## Database Indexing
The JPA SearchParameter database indexing has been redesigned in 6.0.
As a result, performing the upgrade may take longer than usual.
Database migrations happen automatically after server upgrade during the next restart,
and the server is unavailable during this migration window.
To avoid this prolonged outage during server restart, you can apply these
index changes manually before upgrading the server.
The server is compatible with both the old and new indexes.
The syntax for index definition varies, and we include separate scripts for MS Sql, Postgres, and Oracle.
### Upgrade indexing to 6.0 manually on MS Sql Server
This script updates the indexing, and assumes Enterprise Edition.
If you are running Standard Edition, edit the script and remove the ` WITH (ONLINE = ON)` clauses.
**Note:** Without this feature, the database tables will be locked during the creation of each index,
and you will be unable to save, update, or delete any resource until the statement completes.
```sql
-- Table: HFJ_SPIDX_DATE
create index IDX_SP_DATE_HASH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_DATE.IDX_SP_DATE_HASH;
drop index HFJ_SPIDX_DATE.IDX_SP_DATE_HASH_LOW;
create index IDX_SP_DATE_HASH_HIGH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_HIGH, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_DATE.IDX_SP_DATE_HASH_HIGH;
create index IDX_SP_DATE_ORD_HASH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_DATE.IDX_SP_DATE_ORD_HASH;
create index IDX_SP_DATE_ORD_HASH_HIGH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_DATE.IDX_SP_DATE_ORD_HASH_LOW;
create index IDX_SP_DATE_RESID_V2 on HFJ_SPIDX_DATE(RES_ID, HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, PARTITION_ID) WITH (ONLINE = ON);
alter table HFJ_SPIDX_DATE drop constraint FK17S70OA59RM9N61K9THJQRSQM;
drop index HFJ_SPIDX_DATE.IDX_SP_DATE_RESID;
ALTER TABLE HFJ_SPIDX_DATE DROP CONSTRAINT FK17s70oa59rm9n61k9thjqrsqm;
alter table HFJ_SPIDX_DATE add constraint FK_SP_DATE_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index HFJ_SPIDX_DATE.IDX_SP_DATE_UPDATED;
-- Table: HFJ_SPIDX_TOKEN
create index IDX_SP_TOKEN_HASH_V2 on HFJ_SPIDX_TOKEN(HASH_IDENTITY, SP_SYSTEM, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_TOKEN.IDX_SP_TOKEN_HASH;
create index IDX_SP_TOKEN_HASH_S_V2 on HFJ_SPIDX_TOKEN(HASH_SYS, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_TOKEN.IDX_SP_TOKEN_HASH_S;
create index IDX_SP_TOKEN_HASH_SV_V2 on HFJ_SPIDX_TOKEN(HASH_SYS_AND_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_TOKEN.IDX_SP_TOKEN_HASH_SV;
create index IDX_SP_TOKEN_HASH_V_V2 on HFJ_SPIDX_TOKEN(HASH_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_TOKEN.IDX_SP_TOKEN_HASH_V;
drop index HFJ_SPIDX_TOKEN.IDX_SP_TOKEN_UPDATED;
create index IDX_SP_TOKEN_RESID_V2 on HFJ_SPIDX_TOKEN(RES_ID, HASH_SYS_AND_VALUE, HASH_VALUE, HASH_SYS, HASH_IDENTITY, PARTITION_ID) WITH (ONLINE = ON);
alter table HFJ_SPIDX_TOKEN drop constraint FK7ULX3J1GG3V7MAQREJGC7YBC4;
drop index HFJ_SPIDX_TOKEN.IDX_SP_TOKEN_RESID;
ALTER TABLE HFJ_SPIDX_TOKEN DROP CONSTRAINT FK7ulx3j1gg3v7maqrejgc7ybc4;
alter table HFJ_SPIDX_TOKEN add constraint FK_SP_TOKEN_RES foreign key (RES_ID) references HFJ_RESOURCE;
-- Table: HFJ_SPIDX_NUMBER
create index IDX_SP_NUMBER_HASH_VAL_V2 on HFJ_SPIDX_NUMBER(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_NUMBER.IDX_SP_NUMBER_HASH_VAL;
create index IDX_SP_NUMBER_RESID_V2 on HFJ_SPIDX_NUMBER(RES_ID, HASH_IDENTITY, SP_VALUE, PARTITION_ID) WITH (ONLINE = ON);
alter table HFJ_SPIDX_NUMBER drop constraint FKCLTIHNC5TGPRJ9BHPT7XI5OTB;
drop index HFJ_SPIDX_NUMBER.IDX_SP_NUMBER_RESID;
ALTER TABLE HFJ_SPIDX_NUMBER DROP CONSTRAINT FKcltihnc5tgprj9bhpt7xi5otb;
alter table HFJ_SPIDX_NUMBER add constraint FK_SP_NUMBER_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index HFJ_SPIDX_NUMBER.IDX_SP_NUMBER_UPDATED;
-- Table: HFJ_SPIDX_QUANTITY
create index IDX_SP_QUANTITY_HASH_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_QUANTITY.IDX_SP_QUANTITY_HASH;
create index IDX_SP_QUANTITY_HASH_SYSUN_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_QUANTITY.IDX_SP_QUANTITY_HASH_SYSUN;
create index IDX_SP_QUANTITY_HASH_UN_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_QUANTITY.IDX_SP_QUANTITY_HASH_UN;
create index IDX_SP_QUANTITY_RESID_V2 on HFJ_SPIDX_QUANTITY(RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID) WITH (ONLINE = ON);
alter table HFJ_SPIDX_QUANTITY drop constraint FKN603WJJOI1A6ASEWXBBD78BI5;
drop index HFJ_SPIDX_QUANTITY.IDX_SP_QUANTITY_RESID;
ALTER TABLE HFJ_SPIDX_QUANTITY DROP CONSTRAINT FKn603wjjoi1a6asewxbbd78bi5;
alter table HFJ_SPIDX_QUANTITY add constraint FK_SP_QUANTITY_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index HFJ_SPIDX_QUANTITY.IDX_SP_QUANTITY_UPDATED;
-- Table: HFJ_SPIDX_QUANTITY_NRML
create index IDX_SP_QNTY_NRML_HASH_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_QUANTITY_NRML.IDX_SP_QNTY_NRML_HASH;
create index IDX_SP_QNTY_NRML_HASH_SYSUN_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_QUANTITY_NRML.IDX_SP_QNTY_NRML_HASH_SYSUN;
create index IDX_SP_QNTY_NRML_HASH_UN_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_QUANTITY_NRML.IDX_SP_QNTY_NRML_HASH_UN;
create index IDX_SP_QNTY_NRML_RESID_V2 on HFJ_SPIDX_QUANTITY_NRML(RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID) WITH (ONLINE = ON);
alter table HFJ_SPIDX_QUANTITY_NRML drop constraint FKRCJOVMUH5KC0O6FVBLE319PYV;
drop index HFJ_SPIDX_QUANTITY_NRML.IDX_SP_QNTY_NRML_RESID;
ALTER TABLE HFJ_SPIDX_QUANTITY_NRML DROP CONSTRAINT FKrcjovmuh5kc0o6fvble319pyv;
alter table HFJ_SPIDX_QUANTITY_NRML add constraint FK_SP_QUANTITYNM_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index HFJ_SPIDX_QUANTITY_NRML.IDX_SP_QNTY_NRML_UPDATED;
-- Table: HFJ_RESOURCE
create index IDX_RES_TYPE_DEL_UPDATED on HFJ_RESOURCE(RES_TYPE, RES_DELETED_AT, RES_UPDATED, PARTITION_ID, RES_ID) WITH (ONLINE = ON);
drop index HFJ_RESOURCE.IDX_INDEXSTATUS;
drop index HFJ_RESOURCE.IDX_RES_TYPE;
-- Table: HFJ_SPIDX_STRING
create index IDX_SP_STRING_HASH_NRM_V2 on HFJ_SPIDX_STRING(HASH_NORM_PREFIX, SP_VALUE_NORMALIZED, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_STRING.IDX_SP_STRING_HASH_NRM;
create index IDX_SP_STRING_HASH_EXCT_V2 on HFJ_SPIDX_STRING(HASH_EXACT, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
drop index HFJ_SPIDX_STRING.IDX_SP_STRING_HASH_EXCT;
drop index HFJ_SPIDX_STRING.IDX_SP_STRING_UPDATED;
-- Table: HFJ_RES_TAG
create index IDX_RES_TAG_RES_TAG on HFJ_RES_TAG(RES_ID, TAG_ID, PARTITION_ID) WITH (ONLINE = ON);
create index IDX_RES_TAG_TAG_RES on HFJ_RES_TAG(TAG_ID, RES_ID, PARTITION_ID) WITH (ONLINE = ON);
ALTER TABLE HFJ_RES_TAG DROP CONSTRAINT IDX_RESTAG_TAGID;
drop index IDX_RESTAG_TAGID on HFJ_RES_TAG;
ALTER TABLE HFJ_RES_TAG ADD CONSTRAINT IDX_RESTAG_TAGID UNIQUE (RES_ID, TAG_ID);
-- Table: HFJ_TAG_DEF
create index IDX_TAG_DEF_TP_CD_SYS on HFJ_TAG_DEF(TAG_TYPE, TAG_CODE, TAG_SYSTEM, TAG_ID);
ALTER TABLE HFJ_TAG_DEF DROP CONSTRAINT IDX_TAGDEF_TYPESYSCODE;
drop index IDX_TAGDEF_TYPESYSCODE on HFJ_TAG_DEF;
ALTER TABLE HFJ_TAG_DEF ADD CONSTRAINT IDX_TAGDEF_TYPESYSCODE UNIQUE (TAG_TYPE, TAG_CODE, TAG_SYSTEM);
````
### Upgrade indexing to 6.0 manually on Postgres
```sql
-- Table: HFJ_SPIDX_DATE
create index CONCURRENTLY IDX_SP_DATE_HASH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_DATE_HASH;
drop index CONCURRENTLY IDX_SP_DATE_HASH_LOW;
create index CONCURRENTLY IDX_SP_DATE_HASH_HIGH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_HIGH, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_DATE_HASH_HIGH;
create index CONCURRENTLY IDX_SP_DATE_ORD_HASH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_DATE_ORD_HASH;
create index CONCURRENTLY IDX_SP_DATE_ORD_HASH_HIGH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_DATE_ORD_HASH_LOW;
create index CONCURRENTLY IDX_SP_DATE_RESID_V2 on HFJ_SPIDX_DATE(RES_ID, HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, PARTITION_ID);
alter table HFJ_SPIDX_DATE drop constraint FK17S70OA59RM9N61K9THJQRSQM;
drop index CONCURRENTLY IDX_SP_DATE_RESID;
alter table HFJ_SPIDX_DATE add constraint FK_SP_DATE_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index CONCURRENTLY IDX_SP_DATE_UPDATED;
-- Table: HFJ_SPIDX_TOKEN
create index CONCURRENTLY IDX_SP_TOKEN_HASH_V2 on HFJ_SPIDX_TOKEN(HASH_IDENTITY, SP_SYSTEM, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_TOKEN_HASH;
create index CONCURRENTLY IDX_SP_TOKEN_HASH_S_V2 on HFJ_SPIDX_TOKEN(HASH_SYS, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_TOKEN_HASH_S;
create index CONCURRENTLY IDX_SP_TOKEN_HASH_SV_V2 on HFJ_SPIDX_TOKEN(HASH_SYS_AND_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_TOKEN_HASH_SV;
create index CONCURRENTLY IDX_SP_TOKEN_HASH_V_V2 on HFJ_SPIDX_TOKEN(HASH_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_TOKEN_HASH_V;
drop index CONCURRENTLY IDX_SP_TOKEN_UPDATED;
create index CONCURRENTLY IDX_SP_TOKEN_RESID_V2 on HFJ_SPIDX_TOKEN(RES_ID, HASH_SYS_AND_VALUE, HASH_VALUE, HASH_SYS, HASH_IDENTITY, PARTITION_ID);
alter table HFJ_SPIDX_TOKEN drop constraint FK7ULX3J1GG3V7MAQREJGC7YBC4;
drop index CONCURRENTLY IDX_SP_TOKEN_RESID;
alter table HFJ_SPIDX_TOKEN add constraint FK_SP_TOKEN_RES foreign key (RES_ID) references HFJ_RESOURCE;
-- Table: HFJ_SPIDX_NUMBER
create index CONCURRENTLY IDX_SP_NUMBER_HASH_VAL_V2 on HFJ_SPIDX_NUMBER(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_NUMBER_HASH_VAL;
create index CONCURRENTLY IDX_SP_NUMBER_RESID_V2 on HFJ_SPIDX_NUMBER(RES_ID, HASH_IDENTITY, SP_VALUE, PARTITION_ID);
alter table HFJ_SPIDX_NUMBER drop constraint FKCLTIHNC5TGPRJ9BHPT7XI5OTB;
drop index CONCURRENTLY IDX_SP_NUMBER_RESID;
alter table HFJ_SPIDX_NUMBER add constraint FK_SP_NUMBER_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index CONCURRENTLY IDX_SP_NUMBER_UPDATED;
-- Table: HFJ_SPIDX_QUANTITY
create index CONCURRENTLY IDX_SP_QUANTITY_HASH_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_QUANTITY_HASH;
create index CONCURRENTLY IDX_SP_QUANTITY_HASH_SYSUN_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_QUANTITY_HASH_SYSUN;
create index CONCURRENTLY IDX_SP_QUANTITY_HASH_UN_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_QUANTITY_HASH_UN;
create index CONCURRENTLY IDX_SP_QUANTITY_RESID_V2 on HFJ_SPIDX_QUANTITY(RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID);
alter table HFJ_SPIDX_QUANTITY drop constraint FKN603WJJOI1A6ASEWXBBD78BI5;
drop index CONCURRENTLY IDX_SP_QUANTITY_RESID;
alter table HFJ_SPIDX_QUANTITY add constraint FK_SP_QUANTITY_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index CONCURRENTLY IDX_SP_QUANTITY_UPDATED;
-- Table: HFJ_SPIDX_QUANTITY_NRML
create index CONCURRENTLY IDX_SP_QNTY_NRML_HASH_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_QNTY_NRML_HASH;
create index CONCURRENTLY IDX_SP_QNTY_NRML_HASH_SYSUN_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_QNTY_NRML_HASH_SYSUN;
create index CONCURRENTLY IDX_SP_QNTY_NRML_HASH_UN_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_QNTY_NRML_HASH_UN;
create index CONCURRENTLY IDX_SP_QNTY_NRML_RESID_V2 on HFJ_SPIDX_QUANTITY_NRML(RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID);
alter table HFJ_SPIDX_QUANTITY_NRML drop constraint FKRCJOVMUH5KC0O6FVBLE319PYV;
drop index CONCURRENTLY IDX_SP_QNTY_NRML_RESID;
alter table HFJ_SPIDX_QUANTITY_NRML add constraint FK_SP_QUANTITYNM_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index CONCURRENTLY IDX_SP_QNTY_NRML_UPDATED;
-- Table: HFJ_RESOURCE
drop index IDX_INDEXSTATUS;
create index CONCURRENTLY IDX_RES_TYPE_DEL_UPDATED on HFJ_RESOURCE(RES_TYPE, RES_DELETED_AT, RES_UPDATED, PARTITION_ID, RES_ID);
drop index CONCURRENTLY IDX_RES_TYPE;
-- Table: HFJ_SPIDX_STRING
create index CONCURRENTLY IDX_SP_STRING_HASH_NRM_V2 on HFJ_SPIDX_STRING(HASH_NORM_PREFIX, SP_VALUE_NORMALIZED, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_STRING_HASH_NRM;
create index CONCURRENTLY IDX_SP_STRING_HASH_EXCT_V2 on HFJ_SPIDX_STRING(HASH_EXACT, RES_ID, PARTITION_ID);
drop index CONCURRENTLY IDX_SP_STRING_HASH_EXCT;
drop index CONCURRENTLY IDX_SP_STRING_UPDATED;
-- Table: HFJ_RES_TAG
create index CONCURRENTLY IDX_RES_TAG_RES_TAG on HFJ_RES_TAG(RES_ID, TAG_ID, PARTITION_ID);
create index CONCURRENTLY IDX_RES_TAG_TAG_RES on HFJ_RES_TAG(TAG_ID, RES_ID, PARTITION_ID);
alter table HFJ_RES_TAG drop constraint if exists IDX_RESTAG_TAGID cascade;
drop index if exists IDX_RESTAG_TAGID cascade;
ALTER TABLE HFJ_RES_TAG ADD CONSTRAINT IDX_RESTAG_TAGID UNIQUE (RES_ID, TAG_ID);
-- Table: HFJ_TAG_DEF
create index IDX_TAG_DEF_TP_CD_SYS on HFJ_TAG_DEF(TAG_TYPE, TAG_CODE, TAG_SYSTEM, TAG_ID);
alter table HFJ_TAG_DEF drop constraint if exists IDX_TAGDEF_TYPESYSCODE cascade;
drop index if exists IDX_TAGDEF_TYPESYSCODE cascade;
ALTER TABLE HFJ_TAG_DEF ADD CONSTRAINT IDX_TAGDEF_TYPESYSCODE UNIQUE (TAG_TYPE, TAG_CODE, TAG_SYSTEM);
```
### Upgrade indexing to 6.0 manually on Oracle
```sql
-- Table: HFJ_SPIDX_DATE
create index IDX_SP_DATE_HASH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_DATE_HASH ONLINE;
drop index IDX_SP_DATE_HASH_LOW ONLINE;
create index IDX_SP_DATE_HASH_HIGH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_HIGH, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_DATE_HASH_HIGH ONLINE;
create index IDX_SP_DATE_ORD_HASH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_DATE_ORD_HASH ONLINE;
create index IDX_SP_DATE_ORD_HASH_HIGH_V2 on HFJ_SPIDX_DATE(HASH_IDENTITY, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_DATE_ORD_HASH_LOW ONLINE;
create index IDX_SP_DATE_RESID_V2 on HFJ_SPIDX_DATE(RES_ID, HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
alter table HFJ_SPIDX_DATE drop constraint FK17S70OA59RM9N61K9THJQRSQM;
drop index IDX_SP_DATE_RESID ONLINE;
alter table HFJ_SPIDX_DATE add constraint FK_SP_DATE_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index IDX_SP_DATE_UPDATED ONLINE;
-- Table: HFJ_SPIDX_TOKEN
create index IDX_SP_TOKEN_HASH_V2 on HFJ_SPIDX_TOKEN(HASH_IDENTITY, SP_SYSTEM, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_TOKEN_HASH ONLINE;
create index IDX_SP_TOKEN_HASH_S_V2 on HFJ_SPIDX_TOKEN(HASH_SYS, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_TOKEN_HASH_S ONLINE;
create index IDX_SP_TOKEN_HASH_SV_V2 on HFJ_SPIDX_TOKEN(HASH_SYS_AND_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_TOKEN_HASH_SV ONLINE;
create index IDX_SP_TOKEN_HASH_V_V2 on HFJ_SPIDX_TOKEN(HASH_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_TOKEN_HASH_V ONLINE;
drop index IDX_SP_TOKEN_UPDATED ONLINE;
create index IDX_SP_TOKEN_RESID_V2 on HFJ_SPIDX_TOKEN(RES_ID, HASH_SYS_AND_VALUE, HASH_VALUE, HASH_SYS, HASH_IDENTITY, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
alter table HFJ_SPIDX_TOKEN drop constraint FK7ULX3J1GG3V7MAQREJGC7YBC4;
drop index IDX_SP_TOKEN_RESID ONLINE;
alter table HFJ_SPIDX_TOKEN add constraint FK_SP_TOKEN_RES foreign key (RES_ID) references HFJ_RESOURCE;
-- Table: HFJ_SPIDX_NUMBER
create index IDX_SP_NUMBER_HASH_VAL_V2 on HFJ_SPIDX_NUMBER(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_NUMBER_HASH_VAL ONLINE;
create index IDX_SP_NUMBER_RESID_V2 on HFJ_SPIDX_NUMBER(RES_ID, HASH_IDENTITY, SP_VALUE, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
alter table HFJ_SPIDX_NUMBER drop constraint FKCLTIHNC5TGPRJ9BHPT7XI5OTB;
drop index IDX_SP_NUMBER_RESID ONLINE;
alter table HFJ_SPIDX_NUMBER add constraint FK_SP_NUMBER_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index IDX_SP_NUMBER_UPDATED ONLINE;
-- Table: HFJ_SPIDX_QUANTITY
create index IDX_SP_QUANTITY_HASH_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_QUANTITY_HASH ONLINE;
create index IDX_SP_QUANTITY_HASH_SYSUN_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_QUANTITY_HASH_SYSUN ONLINE;
create index IDX_SP_QUANTITY_HASH_UN_V2 on HFJ_SPIDX_QUANTITY(HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_QUANTITY_HASH_UN ONLINE;
create index IDX_SP_QUANTITY_RESID_V2 on HFJ_SPIDX_QUANTITY(RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
alter table HFJ_SPIDX_QUANTITY drop constraint FKN603WJJOI1A6ASEWXBBD78BI5;
drop index IDX_SP_QUANTITY_RESID ONLINE;
alter table HFJ_SPIDX_QUANTITY add constraint FK_SP_QUANTITY_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index IDX_SP_QUANTITY_UPDATED ONLINE;
-- Table: HFJ_SPIDX_QUANTITY_NRML
create index IDX_SP_QNTY_NRML_HASH_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_QNTY_NRML_HASH ONLINE;
create index IDX_SP_QNTY_NRML_HASH_SYSUN_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_QNTY_NRML_HASH_SYSUN ONLINE;
create index IDX_SP_QNTY_NRML_HASH_UN_V2 on HFJ_SPIDX_QUANTITY_NRML(HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_QNTY_NRML_HASH_UN ONLINE;
create index IDX_SP_QNTY_NRML_RESID_V2 on HFJ_SPIDX_QUANTITY_NRML(RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
alter table HFJ_SPIDX_QUANTITY_NRML drop constraint FKRCJOVMUH5KC0O6FVBLE319PYV;
drop index IDX_SP_QNTY_NRML_RESID ONLINE;
alter table HFJ_SPIDX_QUANTITY_NRML add constraint FK_SP_QUANTITYNM_RES foreign key (RES_ID) references HFJ_RESOURCE;
drop index IDX_SP_QNTY_NRML_UPDATED ONLINE;
-- Table: HFJ_RESOURCE
drop index IDX_INDEXSTATUS;
create index IDX_RES_TYPE_DEL_UPDATED on HFJ_RESOURCE(RES_TYPE, RES_DELETED_AT, RES_UPDATED, PARTITION_ID, RES_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_RES_TYPE ONLINE;
-- Table: HFJ_SPIDX_STRING
create index IDX_SP_STRING_HASH_NRM_V2 on HFJ_SPIDX_STRING(HASH_NORM_PREFIX, SP_VALUE_NORMALIZED, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_STRING_HASH_NRM ONLINE;
create index IDX_SP_STRING_HASH_EXCT_V2 on HFJ_SPIDX_STRING(HASH_EXACT, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
drop index IDX_SP_STRING_HASH_EXCT ONLINE;
drop index IDX_SP_STRING_UPDATED ONLINE;
-- Table: HFJ_RES_TAG
create index IDX_RES_TAG_RES_TAG on HFJ_RES_TAG(RES_ID, TAG_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
create index IDX_RES_TAG_TAG_RES on HFJ_RES_TAG(TAG_ID, RES_ID, PARTITION_ID) ONLINE DEFERRED INVALIDATION;
ALTER TABLE HFJ_RES_TAG DROP CONSTRAINT IDX_RESTAG_TAGID;
drop index IDX_RESTAG_TAGID;
ALTER TABLE HFJ_RES_TAG ADD CONSTRAINT IDX_RESTAG_TAGID UNIQUE (RES_ID, TAG_ID);
-- Table: HFJ_TAG_DEF
create index IDX_TAG_DEF_TP_CD_SYS on HFJ_TAG_DEF(TAG_TYPE, TAG_CODE, TAG_SYSTEM, TAG_ID);
ALTER TABLE HFJ_TAG_DEF DROP CONSTRAINT IDX_TAGDEF_TYPESYSCODE;
drop index IDX_TAGDEF_TYPESYSCODE;
ALTER TABLE HFJ_TAG_DEF ADD CONSTRAINT IDX_TAGDEF_TYPESYSCODE UNIQUE (TAG_TYPE, TAG_CODE, TAG_SYSTEM);
```