简体   繁体   中英

How to handle very very large amount of data in Android?

I have a database containing 2 500 000 row of 13-digits numbers (and on end a little bit more - 4 000 000) The user has to find if a 13-digits number exists in this database, all this on his android phone, without any internet connexion. So what do you suggest to deal with this?

I thought about using SQLITE on Android.

What do you suggest?

SQLite will be the best storage option for large data sets on the device. Ensure that where possible you use the correct SQLite query to get the data you need rather then using a general query and doing processing in your own code.

This is a bit too much to add in the comments, so I'll add it here.

4,000,000 rows of integers is not that much. Assuming that the integers will use the maximum size of a signed int (8 bytes), your database will be:

4000000 * 8 / 1024 / 1024 = ~30.5mb

That is large, but not game breaking.

Now that also assumes you will need a full 8 bytes per number. We know that we want to store 13 digits per entry, so a 6 byte integer column would suffice:

4000000 * 6 / 1024 / 1024 = ~23mb

Hi d3cima may be too late answer but it's help other's. Myself Realm is the best option.

Realm

Realm's developer-friendly platform makes it easy to build reactive apps, realtime collaborative features, and offline-first experiences.

Advantage's:

  • faster than SQLite (up to 10x speed up over raw SQLite for normal operations)

  • easy to use

  • object conversion handled for you

  • convenient for creating and storing data on the fly

I used my project it's more than 10 x then Sqlite.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM