# TRUNCATE

The `TRUNCATE` command removes all rows from a table.

## Syntax

```
TRUNCATE [TABLE] <table_name>

```

## Remarks

* For rowstore tables, `TRUNCATE` is the preferred method (vs `DELETE`).
* This command can be run on the master aggregator or a child aggregator (refer to [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.0/reference/sql-reference/cluster-management-commands.md) ).
* 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.0/user-and-cluster-administration/maintain-your-cluster/managing-memory/freeing-table-memory.md).
* The `TRUNCATE` command does not support temporary tables.
* This command causes implicit commits. Refer to [COMMIT](https://docs.singlestore.com/db/v9.0/reference/sql-reference/data-manipulation-language-dml/commit.md) for more information.
* Refer to the [Permissions Matrix](https://docs.singlestore.com/db/v9.0/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permissions.

## Locking Behavior

SingleStore supports online `TRUNCATE`, which waits for DML queries that are already running on the target table to finish before it begins truncating the table. This allows any in-progress queries to complete before the truncate operation starts. New reads and writes on the table are blocked once the `TRUNCATE` command is run on the table. This blocking mechanism preserves the consistency of the results. Once the ongoing read and write operations are completed, `TRUNCATE` acquires a [database-level lock](https://docs.singlestore.com/db/v9.0/reference/sql-reference/operations-that-take-either-a-database-or-a-cluster-level-lock/database-level-locks.md) on the target table and then truncates the table.

Because `TRUNCATE` and `ALTER TABLE` share the database-level DDL operation lock, a concurrent `ALTER TABLE` or `TRUNCATE` on another table in the same database waits while the currently running operation holds the lock. This includes the period when an ongoing `TRUNCATE` is waiting for DML on its target table.

`TRUNCATE` uses the same distributed DDL machinery as `ALTER TABLE`. On a given database, only one `ALTER TABLE` or `TRUNCATE` operation can be in the two-phase commit (2PC) or commit path at a time.

Additionally, concurrent `ALTER TABLE` and `TRUNCATE` operations are not guaranteed to complete in the order in which they were issued. Applications must not rely on FIFO ordering among `ALTER TABLE` and `TRUNCATE` statements waiting for the database-level DDL operation lock.

For online `ALTER TABLE`, data-population that occurs after the 2PC commit can overlap with other operations after the database-level commit lock is released. `TRUNCATE` does not have a long-running data-population phase.

## Delays and Timeout

If `TRUNCATE` statements are frequently run on a table that has a lot of long-running queries, then the workload may experience some additional delay because the `TRUNCATE` operation blocks other queries from starting while it waits for completion of long-running queries.

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

Refer to [ISSUE: Long Running Queries Blocking DDL Operations and Workload](https://docs.singlestore.com/db/v9.0/reference/troubleshooting-reference/query-errors.md) for resolving query timeout errors due to long running queries in a workload.

## Example

```sql
TRUNCATE TABLE testTable;

```

## Related Topics

* [DELETE](https://docs.singlestore.com/db/v9.0/reference/sql-reference/data-manipulation-language-dml/delete.md)
* [ALTER TABLE](https://docs.singlestore.com/db/v9.0/reference/sql-reference/data-definition-language-ddl/alter-table.md)

***

Modified at: October 12, 2026

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

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