What is a maximum size of SQLite database on Android?

后端 未结 4 1997
鱼传尺愫
鱼传尺愫 2020-11-27 17:05

I have a SQLite db that size is over 2.6 GiB. (The db contains maps.) This db is used by RMaps app. When move the maps to some parts at maximum zoom, the app suddenly closes

相关标签:
4条回答
  • 2020-11-27 17:30

    I struggled with getting solid info on this but there are so many variables. This demo Xamarin app allows you to add an example of your own JSON object to an SQLite database repeatedly as fast as you want until you stop it. Allowing you to view the effects both on the size of the database and the performance of the app. It's crude but serves my purposes well and hopefully this can help someone else or you can expand on it. You can find it here.

    0 讨论(0)
  • 2020-11-27 17:33

    Maximum length of a string or BLOB Default size is 1 GB Max size is 2.147483647

    Maximum Number Of Columns Default size is 2000 Max size is 32767

    Maximum Length Of An SQL Statement Default size is 1 MB Max size is 1.073741824

    Maximum Number Of Tables In A Join Default is 64 tables

    Maximum Number Of Attached Databases Default is 10 Max size is 125

    Maximum Number Of Rows In A Table Max Size is 18446744073.709552765

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

    0 讨论(0)
  • 2020-11-27 17:40

    I suspect it is ~2 gigabytes (that might be due to 32-bit architecture, although certain programs come with largefile support, allowing more that that). Fortunately android.database.sqlite.SQLiteDatabase has following API call that returns the maximum size the database may grow to:

    long getMaximumSize()
    

    Eventually you might want to look into database sharding ;)

    0 讨论(0)
  • 2020-11-27 17:40

    SQlite has several limits (http://www.sqlite.org/limits.html) that can come into play with any database. Have you tried vaccum;ing this particular database? It will rebuild the structures. You could have some level of corruption or you have hit one of the other compiled limits that are there to ensure that the DB doesn't become an exploit vector.

    0 讨论(0)
提交回复
热议问题