Description\n-----------\n\nMariaDB has a dedicated VECTOR(N) data type with a built-in data validation. N is the number of dimensions that all vector values in the column have.\n\n Vector indexes are dimensionality-specific.\n All vectors inserted into an indexed column must match the index's target dimensionality.\n Inserting vectors with different dimensionalities will result in an error.\n\nConsider the following table:\n\n``sql\nCREATE TABLE embeddings (\n        doc_id BIGINT UNSIGNED PRIMARY KEY,\n        embedding VECTOR(1536)\n);\n`\n\nTo have a fast vector search, you have to index the vector column, creating a VECTOR index:\n\n`sql\nCREATE TABLE embeddings (\n        doc_id BIGINT UNSIGNED PRIMARY KEY,\n        embedding VECTOR(1536) NOT NULL,\n        VECTOR INDEX (embedding)\n);\n`\n\nNote that there can be only one vector index in the table, and the indexed vector column must be NOT NULL.\n\nThere are two options that can be used to configure the vector index:\n\n M — Larger values mean slower SELECT and INSERT statements, larger index size and higher memory consumption, but more accurate results. The valid range is from 3 to 200.\n* DISTANCE — Distance function to build the vector index for. Searches using a different distance function will not be able to use a vector index. Valid values are cosine and euclidean (the default).\n\n`sql\nCREATE TABLE embeddings (\n        doc_id BIGINT UNSIGNED PRIMARY KEY,\n        embedding VECTOR(1536) NOT NULL,\n        VECTOR INDEX (embedding) M=8 DISTANCE=cosine\n);\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/create-table-with-vectors