删除所有查询或删除查询

时间:2011-09-13 12:08:28

标签: android sqlite

这更好,因为性能明智且无错误导致从android中的sqlite中删除表中的所有行。

删除查询或删除表并重新生成表

我是从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

2 个答案:

答案 0 :(得分:3)

根据sqlite查询,我找到了答案。在sqlite中,他们使用了截断优化,因此当省略“where”子句时,他们删除表并重新创建表,这比删除所有行要快得多。

这是

的链接

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

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

答案 1 :(得分:0)

据我所知 DELETE QUERY 是更好的选择。为什么因为Drop表在内部使用删除查询。如果使用Drop查询,则必须重新生成表。这是一个额外的过程。

相关问题