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
Post a Comment