Skip to main content

TRUNCATE

Delete all rows from a table with minimal computation by restating the table with no data files.

note

This command is not supported on AWS Glue datasources.

Syntax
TRUNCATE [ TABLE ] [ IF EXISTS ] <table_name>

Parameters

TABLE String   Optional

Specifies that the object to be truncated is a table. If not used, the Cloud still recognizes that the object is a table. This option is for consistency with other query engines that can truncate the same tables that Cloud has access to on the datasource.


[ IF EXISTS ] String   Optional

Prevents the datasource from returning an error message if a table with the same definition does not exist in the specified location.


<table_name> String

The name of the table that you want to truncate.


Examples

Truncate a table
TRUNCATE myTable
Truncate a table using supporting clauses
TRUNCATE TABLE IF EXISTS myTable