Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delete all query or drop query

Tags:

android

sqlite

which was more preferable as performance wise and without error cause to delete all the row from table in sqlite in android.

DELETE QUERY OR DROP TABLE AND RE-GENERATE THE TABLE

I have found this from this post

it is more efficient to drop table and re-create it; and yes, You can use "IF EXISTS" in this case

DELETE FROM will cause SQLite to visit individual rows unless those rows have triggers, so it's generally reasonably efficient.


edited after 1 answer post

As the Droping the table using drop table query then internally delete query was used? As in one answer post
like image 349
Pratik Avatar asked Feb 21 '26 12:02

Pratik


1 Answers

As per the sqlite query I found the answer. In sqlite they have used the Truncation Optimization so when the "where" clause was omitted they drop the table and re-create the table this is much faster than delete all rows.

here is the links for that

http://www.sqlite.org/lang_delete.html

http://www.sqlite.org/compile.html#omit_truncate_optimization

like image 175
Pratik Avatar answered Feb 23 '26 02:02

Pratik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!