I am trying to compare two schemas to ensure that they are in sync. In one schema, I see a unique index on 2 columns. In addition to this, I see a unique constraint that uses the unique index.
I'm new to Oracle, but my general understanding and according to this a unique constraint only ensures no duplicates, that it isn't necessarily indexed. For performance an index should be added over the FK columns to allow the constraint to be performed efficiently.
In my target database, I have only the unique index HD_FILL_DISPNSNG_FEE_VAL_AK1.
Since this index it is marked "UNIQUE" doesn't this provide both the unique constraint and the performance benefits of an index? I see many posts on the subject like the referenced link but I am having trouble applying it to this particular situation.
Questions: Would there be any downside to removing the UNIQUE CONSTRAINT since I have the unique index? Similarly, how does a unique constraint that uses an index different than a unique index?
CREATE UNIQUE INDEX RXFINODS_O.HD_FILL_DISPNSNG_FEE_VAL_AK1 ON RXFINODS_O.HD_FILL_DISPNSNG_FEE_VAL
(CVRG_TY_CD, VAL_EFF_START_DT)
LOGGING
TABLESPACE RXFINODS_INDEX
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MAXSIZE UNLIMITED
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
)
NOPARALLEL;
--
-- Non Foreign Key Constraints for Table HD_FILL_DISPNSNG_FEE_VAL
--
ALTER TABLE RXFINODS_O.HD_FILL_DISPNSNG_FEE_VAL ADD (
CONSTRAINT HD_FILL_DSPSNG_FEE_VAL_AK1
UNIQUE (CVRG_TY_CD, VAL_EFF_START_DT)
USING INDEX .HD_FILL_DISPNSNG_FEE_VAL_AK1
ENABLE VALIDATE);