#1 2018-12-07 13:15:43

mtournay
Member
Registered: 2018-11-09
Posts: 1

truncate table

Hi

How can I truncate a table?

regards

Offline

#2 2018-12-07 14:13:54

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: truncate table

There are several Delete() ORM methods available, which could also be nested into a Batch + automatic transaction for best performance.
But nothing similar to a SQL truncate command.

So you need to run the SQL directly, depending on the underlying database engine.
For instance, for SQlite3 it is 'delete from tablename'.

What we usually do is to create a dedicated SQlite3 database for expandable tables.
Then deleting the file is enough to truncate the whole table in a very efficient way. smile

Offline

Board footer

Powered by FluxBB