liveBook · Manning

Truncate

As explained in ScyllaDB in Action

A TRUNCATE statement removes every row from a table while leaving the table structure intact.

TRUNCATE removes every row from a Scylla table while keeping the table itself available for future inserts and updates. section 6.2.4

Clear a test table

Run `TRUNCATE article_summaries_by_date;`. A subsequent `SELECT *` returns zero rows, but the table remains usable. Unlike `DROP TABLE`, TRUNCATE does not remove the table structure. section 6.2.4

cqlsh: reviews> TRUNCATE article_summaries_by_date;

Run the cqlsh command that clears all rows from the review-summary table. section 6.2.4

How ScyllaDB in Action covers it

How deep it goes
Defines the command, contrasts it with DROP TABLE, and demonstrates the resulting empty table.
Examples
Demonstrates truncating article_summaries_by_date and verifying that the table contains zero rows.
What you can do after
Operate Scylla through cqlsh to empty a table without recreating its structure.
How it connects
Contrasts TRUNCATE with DELETE and DROP TABLE as progressively broader data-removal operations.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.