1

I am planning to write an Android application where I'll use its SQLite database. I was wondering what should be my limit to the number of rows I can store. Should I be having a limit?

If that limit is crossed, whats the best strategy to handle that situation provided that I need to keep them and not delete them!

Parth Doshi
  • 4,200
  • 15
  • 79
  • 129
Sunny
  • 286
  • 1
  • 4
  • 14
  • 1
    duplicate http://stackoverflow.com/questions/1546947/maximum-number-of-rows-in-a-sqlite-table – pna Dec 24 '11 at 00:43
  • 2
    @pna: I disagree; that's about SQLite3 specifically and this question is about Android _best practices_. I see them as two very distinctly different things. – sarnold Dec 24 '11 at 00:54

2 Answers2

2

Right now I can verify that my app runs with a 1.3 MB db with no problems.

If you absolutely must maintain all of the data, and you are having problems, you could utilize the SD card, but for most cases, this argument is somewhat moot.

Here is an discussion about maximum database sizes: Link

Ashterothi
  • 3,282
  • 1
  • 21
  • 35
  • Pity the link is on the other side of a login required notice. Care to summarize? – sarnold Dec 24 '11 at 00:53
  • Oh I guess I auto log in to that site, sorry. Basically the limit is storage space unless you set one with setMaximumSize(size). Although one person mentioned that it may be 256 megs – Ashterothi Dec 24 '11 at 01:00
1

You should be limited to as much of the information you need to store in the database. Save what you need. Avoid unnecessary rows.

Keep in mind you can overrite data in your database, for example; A user edits information.

This will allow you to reuse your same rows.

Hope this answers your question

coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118
  • I plan to update rows if user updates information. However, my app can have a million+ rows. I was wondering if I should let the db grow or prune it and save it somewhere else. Not sure if its necessary. – Sunny Dec 24 '11 at 02:36
  • What type of information are you saving? Like users info? Contacts? Id's? – coder_For_Life22 Dec 24 '11 at 02:45
  • Also check out this article on availible storage http://developer.android.com/guide/topics/data/data-storage.html – coder_For_Life22 Dec 24 '11 at 02:46