Informix Error -636
-636 Total size of key fields is too large or there are too many key fields.
You can get this error if you create a BSON/JSON index entry where the key size is so large that it would need to be written to a smart blob (for keys larger than about 4KiB). You cannot create an index on such large keys.
You have violated one of the following constraints on the cluster key that is specified in the ON clause of the CREATE OPTICAL CLUSTER statement:
* The number of columns included in a composite cluster key exceeds 16.
* The length of a CHARACTER column exceeds 256 bytes.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-636 fires in two related but distinct contexts, per the official guidance: a BSON/JSON index
entry whose key would need to be written to a smart blob (keys larger than about 4KiB aren't
indexable), or a violation of the CREATE OPTICAL CLUSTER statement's ON clause cluster-key
constraints — more than 16 columns in a composite cluster key, or a CHARACTER column exceeding
256 bytes.
- A BSON/JSON index built on a field whose value is large enough to require smart-blob storage (roughly 4KiB+), per the official guidance — that size class can't be indexed.
- An optical cluster's
ONclause naming more than 16 columns, per the official guidance — the composite cluster-key column-count limit. - An optical cluster's
ONclause including aCHARACTERcolumn wider than 256 bytes, per the official guidance — the cluster-key width limit.
Solutions / Resolution
- For a BSON/JSON index, per the official guidance, don't index a field whose values are large enough to require smart-blob storage — index a smaller, more selective field instead (or a derived/extracted value from the large field).
- For an optical cluster's cluster key, reduce the number of columns to 16 or fewer, per the official guidance, if the column-count limit was exceeded.
- For an optical cluster's cluster key, reduce a
CHARACTERcolumn's width to 256 bytes or less, per the official guidance, or use a narrower derived column as part of the key instead.
Examples
Reducing an optical cluster's key width
-- Instead of a 300-byte CHARACTER column in the cluster key:
CREATE OPTICAL CLUSTER doc_cluster ON documents (doc_summary_short)
...;
-- where doc_summary_short is a narrower, <=256-byte derived column
Diagnostic Checks
- For a BSON/JSON index failure, check the actual size of the values in the field being indexed against the roughly 4KiB smart-blob threshold.
- For an optical cluster failure, count the columns in the
ONclause against the 16-column limit, and check anyCHARACTERcolumn's declared width against the 256-byte limit.
Related Errors / Related Topics
- -517 — "The total size of the index is too large or too many parts in index." A related
composite-index key-size/column-count limit, in the ordinary (non-optical)
CREATE INDEXcontext. - -550 — "Total length of columns in constraint is too long." Same family of limits, for
UNIQUE/PRIMARY KEY/FOREIGN KEYconstraints. - -631 — "Cannot create optical cluster on column that is not TEXT or BYTE." A related optical-cluster restriction, on the clustered column's own type rather than the cluster key's size.
- -632 — "Cannot create optical cluster." A related, more general optical-cluster-creation failure.
Two distinct limits share this one error message — check whether the context is a BSON/JSON
index or an optical cluster's ON clause before picking which limit applies.