掉落或删除源码 - 表尽可能快的Android设备上 [英] drop or delete a sqlite - table as fast as possible on Android device
问题描述
我有1400行的表。每一行都有持有10KB和500KB之间的数据BLOB字段。我需要删除该表。我花了3.5分钟删除表和3分钟,删除表。过长的用户多数民众赞成。
如何删除该表尽可能快? (无回滚需要或任何安全,只是将其删除。)
我已经尝试以下。
1.设置每页:
sqlitedatabase.setPageSize(8000);
sqlitedatabase.execSQL(DROP TABLE IF EXISTS+ sTableName);
2。关闭journallog没有工作。
sqlitedatabase.rawQuery(PRAGMA journal_mode = OFF,NULL);
sqlitedatabase.execSQL(DROP TABLE IF EXISTS+ sTableName);
这并不为我工作。日记记录,我的猜测花费了大量的时间,仍然被写入到磁盘中。
我得到了我一个解决方案,从而加快了缺失的6倍。
以
connection_read.enableWriteAheadLogging();
我滴在30秒内我的表。没有它,它采用mentoined 3分钟。
enableWriteAheadLogging是另一种日记记录这是方式更快。</ P>
I have a table with 1400 rows. Every row has a blob field which holds data between 10kb and 500kb. I need to delete that table. It takes me 3.5 minutes to delete the table and 3 minutes to drop the table. Thats too long for the users. How can I remove that table as fast as possible ? ( No rollback needed or any security, just remove it. )
I already tried the following. 1. Set pagesize :
sqlitedatabase.setPageSize(8000);
sqlitedatabase.execSQL("DROP TABLE IF EXISTS " + sTableName);
2. deactivate journallog which did not work.
sqlitedatabase.rawQuery("PRAGMA journal_mode=OFF",null);
sqlitedatabase.execSQL("DROP TABLE IF EXISTS " + sTableName);
this doesn't work for me. journal log, which I guess takes a lot of time, is still be written on to the disk.
I got a solution for me, which speeds up the deletion 6 times. with
connection_read.enableWriteAheadLogging();
I drop my table in 30 Seconds. Without it it takes the mentoined 3 minutes. enableWriteAheadLogging is an alternative journal log which is way faster.
这篇关于掉落或删除源码 - 表尽可能快的Android设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!