这在性能方面更可取,并且不会导致从 android 中的 sqlite 中的表中删除所有行。
删除查询或删除表并重新生成表
我从这个找到了这个post https://stackoverflow.com/questions/4280041/sqlite-truncate-a-table-if-exists/4280131#4280131
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
根据 sqlite 查询我找到了答案。在 sqlite 中,他们使用了截断优化,因此当省略“where”子句时,他们会删除表并重新创建表,这比删除所有行要快得多。
这是相关链接
http://www.sqlite.org/lang_delete.html http://www.sqlite.org/lang_delete.html
http://www.sqlite.org/compile.html#omit_truncate_optimization http://www.sqlite.org/compile.html#omit_truncate_optimization
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)