# TRUNCATE

Removes all rows from the table.

`TRUNCATE` is equivalent to running a `DELETE` which removes all the rows from the table but without all the overhead of deleting one row at a time.

## Syntax

```
TRUNCATE [TABLE] <table_name>;

```

## Remarks

* SingleStore supports online `TRUNCATE`, which means that you can read and write while the table is being truncated. For Rowstore tables, `TRUNCATE` is the preferred method (vs `DELETE`).&#x20;
* **Blocking**: Note that online `TRUNCATE` will not begin truncating the table, but it will wait until all DML queries that were already running on the table finish. This allows any in-progress queries to complete execution before truncating the table, and ensures consistency of results from queries on the table since the time of execution of `TRUNCATE`. New read or write queries are blocked until the in-progress queries are finished and `TRUNCATE` has begun truncating the table. This blocking period lasts until all in-progress reads and writes have completed. TRUNCATE blocks the table [via a lock](https://docs.singlestore.com/db/v9.1/reference/sql-reference/operations-that-take-either-a-database-or-a-cluster-level-lock/database-level-locks.md).&#x20;

  If you are frequently running `TRUNCATE` statements on a table and have a lot of long-running queries on that table, then your normal workload may experience some periods of delay since the `TRUNCATE` operation blocks other queries from starting while it waits for completion of long-running queries.

  The `TRUNCATE` operation throws a timeout error if there are long running DML queries in your workload, which extends the blocking period to several minutes.

  Refer to [ISSUE: Long Running Queries Blocking DDL Operations and Workload](https://docs.singlestore.com/db/v9.1/reference/troubleshooting-reference/query-errors.md) for resolving query timeout errors due to long running queries in a workload.
* This command can be run on the master aggregator node, or a child aggregator node (see [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md) ).
* This command causes implicit commits. Refer to [COMMIT](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/commit.md) for more information.
* Table memory can be freed when the `TRUNCATE` command is run. For information on when/how much table memory is freed when this command is run, see [Memory Management](https://docs.singlestore.com/db/v9.1/user-and-cluster-administration/maintain-your-cluster/managing-memory/freeing-table-memory.md).
* The `TRUNCATE` command does not support temporary tables.
* Refer to the [Permissions Matrix](https://docs.singlestore.com/db/v9.1/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permissions.

## Example

```sql
TRUNCATE TABLE table_name;

```

## Related Topics

* [DELETE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/delete.md)

***

Modified at: February 19, 2025

Source: [/db/v9.1/reference/sql-reference/data-definition-language-ddl/truncate/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-definition-language-ddl/truncate/)

(An index of the documentation is available at /llms.txt)
