ORA-1450 and Maximum Key Length - How it is Calculated ----------------------------- When creating an Index, the total length of the index cannot exceed a certain value. This value depends primarily on the DB_BLOCK_SIZE. If an attempt is made to create an index larger than the Maximum value, an ORA-1450 is raised: ORA-01450 maximum key length (758) exceeded ->(2K Block) ORA-01450 maximum key length (1578) exceeded ->(4K block) ORA-01450 maximum key length (3218) exceeded ->(8K Block) ORA-01450 maximum key length (6498) exceeded ->(16K Block) The number in parends is the maximum allowable length of the index key for that particular system. So, how is this number calculated? The maximum key size means: The total index length + length of the key (2 Bytes) + ROWID (6 Bytes) + the length of the rowid (1 byte). The total index length is computed as the sum of the width of all indexed columns plus the number of indexed columns. Date fields have a length of 7, character fields have their defined length, and numeric fields have a length of 22. Numeric length = (precision/2) + 1. If negative, add +1. For Funtion-based indexes, we must calculate the length of the return type. This index key size is limited by the value of db_block_size, because a key value may not span multiple blocks. In fact, it is required that any index block must contain at least TWO index entries per block. Therefore, the maximum key length for an index will be less than half of the DB_BLOCK_SIZE. The Oracle 8i Administrator's Guide states that the maximum size of a single index entry is approximately one-half the data block size. However, when considering that we must also leave space in the blockaccording to PCTFREE, INITRANS, and space for block overhead (Block Header,ROW Directory, Table Directory, etc) the actual space that can be used for the Index key is actually just over 1/3 of the DB_BLOCK_SIZE. Using default values for these storage options, the maximum length for indexes is as follows for different block sizes: DB_BLOCK_SIZE: Maximum Index Key Length: =============== ===================== 2K (2048) 758 Bytes 4K (4096) 1578 Bytes 8K (8192) 3218 Bytes 16K (16384) 6498 Bytes If you hit a maximum key length in an index according to the DB_BLOCK_SIZE, you may need to recreate the database with a larger block size. The otheralternative is to limit the size of the index. This is slightly more difficult with a Function-based index, when the return type is a varchar or RAW. To limit the size of a function-based index you should consider using the SUBSTR or SUBSTRB function, to limit the number of Characters or Bytes returned. For more information on SUBTR and SUBSTRB, refer to the Oracle8i SQL Reference Guide.