0

Hi I have this silly question, but I want to be sure. I have created a database based on sqlite3. I trigger the commit() after 1000k operations so I will not have too much disk I/O. When I seek data on the database, will the select query search only in the database file or will it check the uncommited data too ?

Thanks.

2

2 Answers 2

1

Transactions allow isolation and atomicty regarding other users of the database. Any changes you make are visible in your own connection immediately.

Sign up to request clarification or add additional context in comments.

2 Comments

So uncommited data are visible inside my program . In case that the database is public others won't see those data , right ?
While they won't be visible to other programs using the database, they will only be visible to your program inside the same connection that issued the INSERT statements. Other simultaneous connections in your own program won't see the data. Not a problem if you're using only a single database connection but potentially confusing if you are using multiple connections.
0

If you are using the same SQLite connection for reading as you are for writing the database, then the effects of the writing will be visible to the reader, as expected.

If you are using different connections -- even within a single thread -- for reading and writing, the reader will not see uncommitted writes to the database unless you go to rather significant lengths to allow it to do so.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.