删除所有查询或查询降 [英] delete all query or drop query

查看:125
本文介绍了删除所有查询或查询降的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是更preferable作为明智的性能和无差错的原因,以删除表中的所有行的sqlite的android系统中。

删除查询或DROP TABLE和重新生成表

我发现这个从这个<一个href=\"http://stackoverflow.com/questions/4280041/sqlite-truncate-a-table-if-exists/4280131#4280131\">post

 更有效地删除表并重新创建它;是的,你可以用IF EXISTS,在这种情况下,DELETE FROM会导致SQLite的访问各行,除非这些行具有触发器,因此它通常是相当有效的。
经过1回答后编辑由于滴速使用DROP TABLE查询,然后在内部删除查询表使用?作为一个答案后


解决方案

根据sqlite的查询我找到了答案。 SQLite中,他们使用了优化截断所以当where子句省略他们删除该表并重新创建表,这是远远快于删除所有行。

下面是该链接

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

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

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

解决方案

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

这篇关于删除所有查询或查询降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆