Define a unique secondary index (USI) for the table.
- index_name
- Optional name for the index.
- index_column_name
- Column set whose values are to be used as the basis for a secondary index.
WITH LOAD IDENTITY
Records the RowLoadID for the index created on a load isolated table.
You can specify this option for indexes created on load isolated tables.
- NO
- Does not record RowLoadID with the ROWIDs in a NUSI. The base row, using the qualified ROWID from the index row must be used to determine the committed property. This index may be simpler to maintain but read operations are more expensive than the regular NUSI based option, limiting the usability of index.
Example: Multilevel-Partitioned NUPI With a USI Defined on the Primary Index
The following example creates a two-level PPI table using the RANGE_N function as the basis for both partitioning expressions. Because neither partitioning column is a component of the primary index, that index must be defined as a NUPI. To enforce uniqueness, a USI is defined on o_orderkey.
CREATE TABLE orders ( o_orderkey INTEGER NOT NULL, o_custkey INTEGER, o_orderstatus CHARACTER(1) CASESPECIFIC, o_totalprice DECIMAL(13,2) NOT NULL, o_orderdate DATE FORMAT 'yyyy-mm-dd' NOT NULL, o_orderpriority CHARACTER(21), o_clerk CHARACTER(16), o_shippriority INTEGER, o_comment VARCHAR(79)) PRIMARY INDEX (o_orderkey) PARTITION BY (RANGE_N(o_custkey BETWEEN 0 AND 49999 EACH 100), RANGE_N(o_orderdate BETWEEN DATE '2000-01-01' AND DATE '2006-12-31' EACH INTERVAL '1' MONTH)) UNIQUE INDEX (o_orderkey);