android - Most efficient way to INSERT SQLite data -


on first install, app has cache data gets network, , insert rows sqlite database. end around 700 inserts, takes @ least 15 seconds. logic follows (pseudo):

scrollthroughallobjects(){     if(objectdoesnotexist){         cacheobject();     } }  cacheobject(object ob){     contentvalues values = new contentvalues();     values.put(key_id, ob.getid);     // add lots more values     return mdb.insert(database_table, null, values); } 

is there more efficient, quicker, way me handle insert?

perform record insertion using sqlite transaction. amazingly speed entire process; because when perform single insertion (one @ time) sqlite treats each insertion transaction , needs create journal-file each execution (which takes time). however, when bind add/edit/delete queries single transaction 1 journal file created throughout end of transaction causing sqlite execute queries rapidly.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -