which was more preferable as performance wise and without erro开发者_如何转开发r 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
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
As per my knowledge DELETE QUERY is the better option.why because the Drop table internally uses the delete query. If you use the Drop query ,you have to regenerate the table.This is one more extra process.
精彩评论