# Data Types


MatrixOne data types are largely consistent with MySQL conventions and extend them with types such as **VECTOR** and **DATALINK**. The following tables summarize commonly used product types and their ranges. For details not listed here, refer to the behavior of the instance engine.

## Integers

| Type | Storage | Signed range (summary) | Unsigned range |
| --- | --- | --- | --- |
| TINYINT | 1 byte | -128 to 127 | 0 to 255 |
| SMALLINT | 2 bytes | -32768 to 32767 | 0 to 65535 |
| INT | 4 bytes | Approximately ±2.1e9 | 0 to approximately 4.2e9 |
| BIGINT | 8 bytes | Approximately ±9.2e18 | 0 to approximately 1.8e19 |

## Floating-point and exact numeric types

| Type | Description |
| --- | --- |
| FLOAT / FLOAT32 | Single precision. You can use `FLOAT(M,D)` to control display precision (M and D have upper limits). |
| DOUBLE / FLOAT64 | Double precision. You can use `DOUBLE(M,D)`. |
| DECIMAL | Exact numeric type, suitable for fixed-point values such as monetary amounts. |

Floating-point values have rounding errors. Prefer `DECIMAL` for financial data and counts.

## Strings and binary types

| Type | Description |
| --- | --- |
| CHAR / VARCHAR | Fixed-length / variable-length strings |
| BINARY / VARBINARY | Binary strings |
| TEXT / BLOB | Long text / binary large objects. TINY, MEDIUM, LONG, and similar subtype names are handled as the same large-object type when they are not distinguished. |
| ENUM | Enumeration whose values come from a predefined string list and are represented internally as integers |
| BIT(M) | Bit string. M ranges from 1 to 64 and defaults to 1. |

## Date and time

| Type | Description |
| --- | --- |
| DATE | Date |
| TIME | Time |
| DATETIME | Date and time |
| TIMESTAMP | Timestamp. Time-zone behavior is affected by settings such as `time_zone`. |
| YEAR | Year |

Initialization rules for `TIMESTAMP`, including default values and `ON UPDATE`, are similar to MySQL. Actual support depends on the current instance.

## JSON

Stores JSON documents. Use functions such as `JSON_EXTRACT`, `JSON_EXTRACT_STRING`, `JSON_EXTRACT_FLOAT64`, and `JQ` / `TRY_JQ` to query and transform them. See [Functions](functions.md).

## UUID

The UUID type stores universally unique identifiers generated by functions such as `UUID()`.

## DATALINK

References file resources in external locations or Stages. It can be used with `LOAD_FILE` / `SAVE_FILE` for unstructured or file-based data references. Availability depends on the product capabilities currently enabled.

## VECTOR

Designed for embeddings and similarity search:

| Item | Description |
| --- | --- |
| Element type | Currently `vecf32` (float32) and `vecf64` (float64) |
| Dimensions | Specified when the column is created, such as `vecf32(768)`. The upper limit is high; documentation commonly lists approximately 65,536. |
| Shape | One-dimensional vectors, not general multidimensional matrices |
| Constraint | **Cannot** be used as a primary or unique key |
| Search | Used with `L2_DISTANCE`, `COSINE_SIMILARITY`, `INNER_PRODUCT`, and vector indexes such as IVF Flat |

```sql
CREATE TABLE t1 (
  id INT,
  emb vecf32(3)
);
```

Insertion supports literal arrays and other forms. The exact literal syntax depends on the client and version.

## Type conversion

- Implicit conversion: When the types on both sides of an expression differ, the engine promotes or converts them according to its rules. It reports an error if conversion fails.
- Explicit conversion: Use `CAST()`, `CONVERT()`, `BINARY()`, and similar operations. See [Operators](operators.md).
