Manali Sheth
Manali Sheth

Reputation: 379

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...:)

Upvotes: 10

Views: 20964

Answers (4)

Mahmoud
Mahmoud

Reputation: 2883

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.

Upvotes: 3

Shekhar
Shekhar

Reputation: 832

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).

Upvotes: 8

Pankaj Zanzane
Pankaj Zanzane

Reputation: 1242

You can store this much data in sqlite.This might affect query search on your tables not your application and you should always interact with your database on separate thread rather than main thread. But you should consider removing rows from tables which are not required by user anymore,this might release some load from database.

Upvotes: 0

Simon Dorociak
Simon Dorociak

Reputation: 33495

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

Upvotes: 2

Related Questions