Method: Cequel::Schema::Keyspace#truncate_table

Defined in:
lib/cequel/schema/keyspace.rb

#truncate_table(name) ⇒ void

This method returns an undefined value.

Remove all data from this table. Truncating a table can be much slower than simply iterating over its keys and issuing ‘DELETE` statements, particularly if the table does not have many rows. Truncating is equivalent to dropping a table and then recreating it

Parameters:

  • name (Symbol)

    name of the table to truncate.

Since:

  • 1.0.0



186
187
188
# File 'lib/cequel/schema/keyspace.rb', line 186

def truncate_table(name)
  keyspace.execute("TRUNCATE #{name}")
end