I want to know is Database more efficient or just a normal json file if it has many items, in android device.
There is an option when "connecting" to an SQLite database of using memory
instead of filesystem
as storage.
But it is used only when creating new databases so the "new" in memory database will be empty. This is useful when you want to take advantage of SQL like indexing and querying on a large set of data.
Unfortunately copy from filesystem into memory (or vice-versa) is not a feature in SQLite. It's a design choice because the SQLite file must be locked by your (or others) for concurrency control.
Typically a DSN
to connect to an SQLite database would look like this 'sqlite:/path/to/file.sqlite'
. And access control to the database is given by access filesystem rights. In the case of in memory databases the DSN
will look like this 'sqlite::memory'
.