android – What is the storage limit of SQLite?

Question:

A new demand has arisen for the application of the company where I work, I need to store more than 100k of records in different tables, I'm worried if SQLite will withstand such demand, my question is:

  • Does SQLite have a storage limit?
  • Does the data type influence the storage limit?

Answer:

The row limit is 2 to the power of 64, that is, there is no practical limit.

There is a limit of 128TB on the total size of database bytes , which in practice is difficult to achieve. Remembering that SQLite works with the entire database in a single file.

Of course, this limit depends on SQLite's configuration, either in its compilation or by some PRAGMA , so it is possible to change it.

Almost all database limits can be configured and the relevant ones are available in the documentation .

The size of pages can positively or negatively affect the performance of the database. In general, the best results are obtained between 8K and 32K, which would limit the size a little more if you are looking for maximum performance (but it changes little and depends on the scenario).

SQLite's biggest scalability problem comes when it needs a very large amount of concurrent writes. As its locking has no granularity, any write attempt prevents further writes even at points that are not in concurrency. It does not affect reading unless you are using WAL, which is recommended in almost all situations.

The data type does not influence the limit, only the occupied size. Of course, each type has its own limit.

Scroll to Top