Most datatypes can be used in indexes, but there are restrictions
when using LongText
data types.
Indexes in the store database are B+tree structures with a fixed size key. This means that text keys may easily generate large indexes, and a maximum length text column cannot be indexed.
Keys in DBMS may be truncated by specifying the length of a text column to be used in the index key. Such a key column must always be the last one in the key, to ensure that the index provides a true ordering. If a text key column does not supply a truncation length, the full length of the table column is used.
Apart from Binary
and LongBinary
columns,
all types can be used in an index key including LongText8
and LongText16
,
although these must supply a truncation length (as they have no maximum length)
and must therefore be the last key columns in the key.