Question: I am creating an index and I get this
error: "ORA-01450: maximum key length (string) exceeded".
I know that the maximum key length is related to the blocksize
and I wonder if I should I try to create the index again with a larger blocksize?
The ORA-01450 error is related to your db_block_size
and the maximum key length for your database is
approximately 40% of the database block size minus some
However, you have a bigger problem, getting
the CBO to use an index with a large key value!
Indexes with long index keys are rarely used!
As a general rule, indexing on very large columns (raw, long,
clob) is rarely useful because the optimizer will almost always
find a full-table scan cheaper than invoking an index on a long
And no, I would not recommend rebuilding this index in a larger
building indexes in a larger blocksize has some marginal
benefits for super high-volume databases (a flatter tree structure,
and faster throughput for index
range scans), the Oracle CBO will almost always choose a
full-table scan over an index on a very large key.
I would consider looking into Oracle context indexes if
the database is read-only during the query window and you wish to search into long text values:
The Oracle docs have these notes on the ORA-01450 error:
ORA-01450: maximum key length (string) exceeded
Cause: The combined length of all the columns
specified in a CREATE INDEX statement exceeded the maximum index
length. The maximum index length varies by operating system.
total index length is computed as the sum of the width of all
indexed columns plus the number of indexed columns.
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.
Action: Select columns to be indexed so the
total index length does not exceed the maximum index length for
the operating system.
See also your operating system-specific
Jmodic has these observations about the relationship between
the ORA-01450 error and the database blocksize:
The maximum allowed index key length depends on your block size.
So the minimum allowed size reported in ORA-01450 varies,
depending on which block size your index is using:
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)
MOSC Note 136158.1
MOSC Note 236329.1
for more details on the ORA-01450 error
and key length.