Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary Database #1147

Closed
ynixt opened this issue Jul 22, 2024 · 4 comments
Closed

Temporary Database #1147

ynixt opened this issue Jul 22, 2024 · 4 comments
Labels
documentation question Further information is requested

Comments

@ynixt
Copy link

ynixt commented Jul 22, 2024

Can we use sqlite temporary database with this driver? I know that the driver supports in-memory, but it is not the same:

Even though a disk file is allocated for each temporary database, in practice the temporary database usually resides in the in-memory pager cache and hence there is very little difference between a pure in-memory database created by ":memory:" and a temporary database created by an empty filename. The sole difference is that a ":memory:" database must remain in memory at all times whereas parts of a temporary database might be flushed to disk if the database becomes large or if SQLite comes under memory pressure.

@gotson gotson added the question Further information is requested label Jul 22, 2024
@gotson
Copy link
Collaborator

gotson commented Jul 22, 2024

If you don't pass a file name it should be a temporary database. Seems documented here: https://github.com/xerial/sqlite-jdbc/blob/master/USAGE.md#how-to-use-memory-databases

@ynixt
Copy link
Author

ynixt commented Jul 22, 2024

I hadn't noticed because the documentation says "memory database" instead of "temporary database". In short, it was my fault. Thanks.

@ynixt ynixt closed this as completed Jul 22, 2024
@gotson
Copy link
Collaborator

gotson commented Jul 23, 2024

I hadn't noticed because the documentation says "memory database" instead of "temporary database". In short, it was my fault. Thanks.

i was not aware of the difference to be honest, i have updated the wording in the documentation

@ynixt
Copy link
Author

ynixt commented Jul 24, 2024

I hadn't noticed because the documentation says "memory database" instead of "temporary database". In short, it was my fault. Thanks.

i was not aware of the difference to be honest, i have updated the wording in the documentation

Thank you for that, it's easier to understand.

The "memory database" is always on the memory and doesn't have any file. On the other hand, the "temporary database" creates a file in the temp path of the system, and the file is automatically deleted after the connection closes. This temporary file will be used if the database becomes large or if SQLite comes under memory pressure to flush to the disk parts of the database.

Source: https://www.sqlite.org/inmemorydb.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants