It is often better to insert all the data and THEN create the indexes. I couldn't tell you about Sqlite.
You may want to create the primary index, but create all the other indexes later. On Apr 12, 5:33 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote: > No, database writing is extremely slow especially with many indecies. > > In my app, I am getting maybe 10 insers a seconds into a table with 20 > columns and 15 indecies. As my app is probably 99.9% reads, I didn't > try optimizing the writes too much, not sure if it's even possible. > > On Apr 13, 12:33 am, Yahel <kaye...@gmail.com> wrote: > > > > > Ok, you are right if the pre and the iphone are 10x faster, it can't > > be right. > > > I don't see anything wrong in your code, so only two things come to > > mind : > > > - Instead of using ContentValues, try to create an insert sql > > statement and send it to via SQLiteDatabase.execSQL to see if there is > > any improvement > > - Maybe it's not the database writing that is slow but the reading > > from wherever your getting the data ? > > > Yahel > > > On 12 avr, 12:31, Alok Kulkarni <kulsu...@gmail.com> wrote: > > > > Ok, > > > @Yahel:- For the insertion of same records on a Palm device(Say Palm Pre) > > > , > > > its taking 3 seconds.. > > > On an IPhone , its taking 1 or 2 seconds.. > > > Here is an example of what i am doing.. > > > private Boolean addAlbumDB(int AlbumId, String Name, String Label, > > > int MultipleArtists, int ArtistId) { > > > long result = -1; > > > > try { > > > > ContentValues initialValues = new ContentValues(); > > > initialValues.put(KEY_ID, AlbumId); > > > initialValues.put(KEY_NAME, Name); > > > initialValues.put(KEY_LABEL, Label); > > > initialValues.put(KEY_ARTIST_ID, ArtistId); > > > initialValues.put(KEY_MULTIPLE_ARTISTS, MultipleArtists); > > > > result = db.insert(DATABASE_TABLE, null, initialValues); > > > > } catch (Exception e) { > > > Log.i("Exception in addAlbumDB", "" + e.toString()); > > > return false; > > > } > > > > if (result == -1) > > > return false; > > > return true; > > > } > > > > The above function is called for around 2000 times.. > > > Similarly there are 2 3 more functions for other tables. > > > Thanks, > > > Alok. > > > > On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger > > > <mike.rue...@gmail.com>wrote: > > > > > On 4/12/2010 10:59 AM, Yahel wrote: > > > > >> Hi Alok, > > > > >> Posting some logic, or some sql would help us see if you are missing > > > >> something :) > > > > > (excessive) use of indices comes to mind :-) > > > > > Michael > > > > >> Yahel > > > > >> On 12 avr, 08:50, Alok Kulkarni<kulsu...@gmail.com> wrote: > > > > >>> Hi, > > > >>> I am inserting around 7000 to 8000 records in my database having 4 > > > >>> tables > > > >>> each having 3 to 4 columns.Its taking me around 22 seconds to do the > > > >>> insertion which is i think is too long. I am using transaction while > > > >>> doing > > > >>> this without which its taking around 55 seconds. > > > >>> According to SQLite documentation , inserting 10000 records in a > > > >>> database > > > >>> takes time around 2 to 3 seconds. > > > >>> Am i missing something , or is the behaviour correct? > > > >>> Thanks, > > > >>> Alok > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Android Developers" group. > > > > To post to this group, send email to android-developers@googlegroups.com > > > > To unsubscribe from this group, send email to > > > > android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs > > > > cr...@googlegroups.com> > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en > > > > > To unsubscribe, reply using "remove me" as the subject.- Hide quoted > > > > text - > > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en