---
sidebar_position: 3
title: Data types
description: Supported data types in DuckDB including numeric, string, date/time, and complex types.
---

import PartialExample from './_include-thing-for-parity-with-duckdb.mdx';

<PartialExample thing="Supported data types" verb="are" url="https://duckdb.org/docs/stable/sql/data_types/overview" linkText="Data Types" />

## VARIANT type

Starting with DuckDB 1.5, the `VARIANT` type provides a high-performance way to store and query semi-structured data. It is a strongly typed alternative to storing data as plain `JSON` or `VARCHAR` columns that delivers significantly faster reads and writes.

### How VARIANT works

When data is stored as `VARIANT`, DuckDB automatically "shreds" (decomposes) the semi-structured values into their underlying typed columns in Parquet files. This means a column of mixed JSON objects is stored as efficiently typed columnar data rather than opaque strings, enabling:

- **Columnar compression** on the underlying typed values
- **Predicate pushdown** using row group statistics
- **Faster reads** by scanning only the fields you reference in your query

### Using VARIANT

```sql
-- Create a table with a VARIANT column
CREATE TABLE events (
    id INTEGER,
    payload VARIANT
);

-- Insert JSON data -- it is automatically converted to VARIANT
INSERT INTO events VALUES
    (1, '{"user": "alice", "action": "click", "ts": "2026-03-19T10:00:00Z"}'::VARIANT),
    (2, '{"user": "bob", "action": "purchase", "amount": 42.50}'::VARIANT);

-- Query individual fields
SELECT
    id,
    payload->>'user' AS user_name,
    payload->>'action' AS action
FROM events;
```

### VARIANT in DuckLake

[DuckLake](/integrations/file-formats/ducklake/) tables support `VARIANT` columns starting with DuckLake 0.4. This combination is particularly effective for workloads with high-volume semi-structured data because DuckLake's Parquet-backed storage takes full advantage of VARIANT shredding.

For complete details on the VARIANT type, see [VARIANT](https://duckdb.org/docs/stable/sql/data_types/variant) in the DuckDB documentation.
