How to manage a database with 400,000 records in iPhone and Android?

I have a requirement for a database with 400,000 entries in iPhone and Android. Is there any better way to do this? Is it possible?

+6
source share
2 answers

Yes it is possible.

You can put your database in the asset or raw folder. Then copy your database on First Run .

You can check if the database exists or not.

see this answer for copying a large database.

But if you have no problems with Internet access , you can develop a simple webservice

+3
source

400,000 entries are pretty few. Even the amount of memory that it takes is likely to be quite high, and then there will be a problem with running queries. Here are some tips for optimizing speed:

If you really need it on your device

  • Divide the records into several tables in alphabetical order (or in some other way). Thus, any queries on records beginning with A need to be searched in only one part of the database, and not in 400,000 records. This will improve query speed. You may not be able to separate the data alphabetically, but this was just an example.

If its presence on the device is not an option

  • Get a high-performance server that can quickly run queries, and write a small PHP script to interact with it and receive your data. This will significantly improve speed and will have an additional advantage: you do not need to update the application every time your data changes (downloading an application with a database of 400,000 records every time your data changes are not evaluated by users).

You can also refer to this article for more information on working with large Android databases.

Also, I read on another SO post that due to performance there is a soft limit of 10,000 entries. You may or may not get around this.

+2
source

Source: https://habr.com/ru/post/922806/


All Articles