|SQL Language Reference / SQL Statements|
Remove all content from a table and return it to its initial, empty state. TRUNCATE TABLE clears all in-memory data for the specified table as well as any data that was persisted to GemFire XD disk stores. For HDFS read-write tables, TRUNCATE TABLE also marks the table's HDFS persistence files for expiiry. For HDFS write-only tables, TRUNCATE TABLE leaves all table data that is stored in HDFS log files available for later processing using MapReduce or HAWQ.
TRUNCATE TABLE table-name
For HDFS Read-Write tables, TRUNCATE TABLE removes the in-memory data for the table and marks the table's HDFS log files for expiry. This means that GemFire XD queries, MapReduce jobs with CHECKPOINT mode enabled, and HAWQ external tables with CHECKPOINT mode enabled no longer return data for the truncated table. MapReduce jobs and HAWQ external tables that do not use CHECKPOINT mode will continue to return some table values until the log files expire.
To truncate a table, you must be the table's owner. You cannot use this command to truncate system tables.
To truncate the "flights" table in the current schema:
TRUNCATE TABLE flights;