Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum SQLite Database Size in Android Application

I am new to the Android Development.

Currently, I am working on one Android Application having a large amount of data.

So I have thought that I should have to store some of those data locally.

I have one database having 2 tables.

Table-1's size is: 4.5 MB Table-2's size is: 3.5 MB currently.

i.e. Totally around 8.0 MB but in future database size can be increased and may be reach to 10 MB.

Table-1: Rows(14927) and Columns(17) Table-2: Rows(9903) and Columns(38)

My doubt is that can i store this much data locally in an android application or the application's speed can be affect by it.

I don't want to store these data in external storage. And I can't store it on server database as I have to use these data many times in the application. While the other data is on server as it must be used centrally.

This is my point of view. But please give me your suggestions.

What to do if there is such size of database.

Please help me. Thanks in advance...:)

like image 244
Manali Sheth Avatar asked Aug 27 '13 07:08

Manali Sheth


3 Answers

The maximum database size can be approximately 1.4e+14 bytes (140 terabytes, or 140,000 gigabytes).

Reference: The Official SQLite Documentation and limits

14. Maximum Database Size

Every database consists of one or more "pages". Within a single database, every page is the same size, but different database can have page sizes that are powers of two between 512 and 65536, inclusive. The maximum size of a database file is 2147483646 pages. At the maximum page size of 65536 bytes, this translates into a maximum database size of approximately 1.4e+14 bytes (140 terabytes, or 128 tebibytes, or 140,000 gigabytes or 128,000 gibibytes).

like image 186
Shekhar Avatar answered Sep 21 '22 19:09

Shekhar


You can store that much of data without a problem, I'm working on a DB, the size of it is about 35MB.

You could use caching to speed up fetching data.

like image 22
Mahmoud Avatar answered Sep 25 '22 19:09

Mahmoud


I don't want to store these data in external storage. And I can't store it on server database as I have to use these data many times in the application.

So if you don't want to use external storage, your only way is to use internal storage (also you don't want to use remote server). Usually when database has bigger size, external storage is usually used for optimizing application. But it also depends on character of data e.q. if they are sensitive or not so external storage is not always win.

But in your case i don't think that your application performance will be decreased. Only queries over your database can last longer than queries over 10-100 rows (queries can be omptimized by creating appropriate indexes).

But a few suggestions for increase performance:

  • Try to remove records which are not used for longer time
  • You can compress your data that will result in smaller db size
like image 36
Simon Dorociak Avatar answered Sep 23 '22 19:09

Simon Dorociak