Reputation: 111
I want to create sqlite partition structure, I created 3 databases, I attached those 3 databases to another database which will be parent with
ATTACH DATABASE '1.db' as 1
ATTACH DATABASE '2.db' as 2
ATTACH DATABASE '3.db' as 3
after i .quit
the parent database the database attachments detach, How can I keep them attached even if I quit the database?
Thanks.
Upvotes: 7
Views: 19552
Reputation: 12925
Attachments are not permanent.
When partitioning a SQLITE database, the natural way to do it is to create a separate database for each X, where X is some element in the system that represents a query boundary that you don't need to cross.
For example, you can create a separate database for each user.
Or you can hash to 2 bytes on some key, and create a database for each pair of bytes, ameliorating lock contention.
If you don't have a natural partition in your data, and you need to scale beyond the capabilities of sqlite, you should consider another DB.
Upvotes: 5
Reputation: 180192
Attachments are never permanent.
Every program that opens the database needs to make any attachments it needs.
If you really think you need partitioning, using another database might be a better idea.
Upvotes: 8