Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dealing with a large database in Android

Tags:

android

sqlite

I'm currently developing an app that has the potential to create a very large database. I had planned on installing the app on the SD card to allow for some extra room. Recent dealings here have warned me that that might not be a good idea. Are there any steps I can take to mitigate the danger of this course of action? Or are there any better alternatives?

like image 551
Lunchbox Avatar asked Jan 21 '11 14:01

Lunchbox


People also ask

What is the best database to use with Android?

PostgreSQL. A unique relational database, PostgreSQL is the best database for Android and iOS apps. Developers can customize this database as they want; that's why it's the most preferred mobile app database.

What is the maximum size of SQLite database in Android?

Maximum Database Size 140 tb but it will depends on your device disk size.

Where is the database stored in Android?

The Android SDK provides dedicated APIs that allow developers to use SQLite databases in their applications. The SQLite files are generally stored on the internal storage under /data/data/<packageName>/databases.


Video Answer


1 Answers

This is a comprehensive post on the subject (I'm not the author).

I think, overall, it needs to be communicated that SQLite is just a SQL mechanism for accessing a file. It appears that the current market limit is 50mb for the entire APK. When installing to internal memory, you require 2x your APK size. Installing to sdcard requires just the stated APK size.

Here is what you will be working against: 1.) Since SQLite is just a abstraction over your file, when you do selects, inserts, updates, etc, you will be incurring sdcard read write costs 2.) I've seen mention of a soft limit of 10000 records based on performance. This article is a bit old, so its likely gotten better.

Other then that, you'll probably have to set up some tests to see what is feasible. Cursory search of google did not show any benchmarks to date.

like image 197
Nick Campion Avatar answered Oct 18 '22 17:10

Nick Campion