In SQLITE, how do you create a new table into its own file?

All we need is an easy explanation of the problem, so here it is.

I am trying to do key value pairing, where performance is the top priority. I understand that the smaller a sqlite file is, the better the read and write speeds are, and so I am going to create about 64 files, having every explicit key-value combination.

Hence I would like to create a command that will create a new table inside its own file. How do I do this?


How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

If you’re trying to store key-value pairs of data you should use a key-value store database instead of SQLite, since SQLite is meant to store relational data. Where is your database going to live?…mobile device or dedicated server?

If you do stick to SQLite though, file size is not much of a factor in terms of read and write speeds. Rather you’re probably thinking of concurrency issues, especially with concurrent writes to the database. In that case, you can do things like enabling the WAL and possibly creating a separate database for any groups of tables you would need to heavily concurrently write to, since concurrency issues mostly occur within the same database. Also ensure you index your tables appropriately, which will likely just be the key of your key-value pairs.

Also switching to an appropriate key-value data store would likely help you with any concurrency issues as well.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply