Thanks. Good to know.

________________________________
 From: Clemens Ladisch <clem...@ladisch.de>
To: sqlite-users@sqlite.org 
Sent: Monday, October 22, 2012 1:02 PM
Subject: Re: [sqlite] TRUNCATE TABLE alias for DELETE FROM
 
giris wrote:
> Rather, the implementation/internals of SQLite need to change to allow this
> very low overhead form of DELETE.

Actually, SQLite already implements the low-overhead from of DELETE.
src/delete.c has in sqlite3DeleteFrom():

#ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
  /* Special case: A DELETE without a WHERE clause deletes everything.
  ** It is easier just to erase the whole table. Prior to version 3.6.5,
  ** this optimization caused the row change count (the value returned by
  ** API function sqlite3_count_changes) to be set incorrectly.  */
  if( rcauth==SQLITE_OK && pWhere==0 && !pTrigger && !IsVirtual(pTab)
   && 0==sqlite3FkRequired(pParse, pTab, 0, 0)

It would be possible to implement TRUNCATE TABLE on top of that, but
this would be only syntactic
 sugar.


Regards,
Clemens
_______________________________________________
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