> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TRUNCATE TABLE

> Remove every row from a table while preserving its schema and history.

Enterprise only

`TRUNCATE` removes every row from one native base table and commits one new
table version, including when the table is already empty. The `TABLE` keyword
is optional:

```sql theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
TRUNCATE TABLE events;
TRUNCATE TABLE analytics.team.events;
TRUNCATE events;
```

Unqualified names use the session database and namespace. Qualified names
follow the usual [SQL identifier rules](https://docs.lancedb.com/enterprise/v1-16-0/sql/identifiers.md).

## Permissions and supported tables

`TRUNCATE` requires the same permissions as `DELETE`: `DELETE` on the table
and `USAGE` on its database and namespace. It does not require `SELECT` or
table ownership.

Views, materialized views, and system tables cannot be truncated. WAL-backed
tables are also refused: as with `DELETE` without a `WHERE` clause, truncation
cannot atomically remove rows from both the base table and the WAL tier.

Tables with Function columns follow the same behavior as an unfiltered
`DELETE`. Their column declarations and Function bindings remain. Materialized
views reading the table retain their stored rows until refreshed; their next
refresh observes the empty source.

`RESTART IDENTITY`, `CASCADE`, multiple table targets, and a `WHERE` clause are
unsupported and rejected before execution.

## Result and recovery

The result has the same columns as `DELETE`:

| Column | Value |
| - | - |
| `table` | The table name. |
| `operation` | `TRUNCATE`. |
| `rows_affected` | The number of rows removed. |
| `version` | The committed table version. |

Truncation preserves the schema, indexes, tags, branches, and earlier table
versions. To recover rows, restore a version retained from before truncation:

```sql theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
SHOW VERSIONS FOR TABLE events;
RESTORE TABLE events TO VERSION 2;
```

Restore requires table ownership. The old version and its data must still be
retained; versions removed by cleanup cannot be restored.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.