Hi:

Mapping TRUNCATE table to DELETE * is not going to help and seems like
a bad idea.

TRUNCATE table is an artifact implemented in many SQL implementations,
and can make a world of difference in performance when deleting all rows 
in a table. It avoids all the overhead of transaction logging, deallocation, 
and related
record keeping.

Rather, the implementation/internals of SQLite need to change to allow this 
very low overhead form of DELETE.
If you do need to delete all rows in a table AND have the DDL to create 
the table handy, simply drop the table and re-create it.

If you need to delete most of the rows, you can use a  technique often 
performed 
in Data Warehousing, known as CTAS (CREATE TABLE AS SELECT . . .) 
wherein you select the rows you want to keep into a new table, drop the old 
one, 
and rename the new table to the old name, if RENAME is supported by 
your version of SQLite.

HTH.

Thanks.


________________________________
 From: Paul van Helden <p...@planetgis.co.za>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org> 
Sent: Monday, October 22, 2012 11:10 AM
Subject: [sqlite] TRUNCATE TABLE alias for DELETE FROM
 
Hi,

TRUNCATE TABLE is now in the SQL:2008 standard.
http://en.wikipedia.org/wiki/Truncate_(SQL) It would make portability
easier if SQLite understood TRUNCATE TABLE to be the same as DELETE FROM
without WHERE.

Yes? No?

Paul.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to