Search code examples
androidsqlitejournal

How to disable Android SQLite Journal file?


I am using transactions to insert multiple rows into table. But, I still see temporary sqlite-journal file being created on SD Card along with sqlite table.

How do I disable creation of journal file?

Thanks


Solution

  • You can elect to keep the journal in memory so that no -journal file is created:

    pragma journal_mode=memory;
    

    Note that you need to run this each time you open the database.

    I recommend that you read the following to get a better idea of what is going on:

    http://www.sqlite.org/pragma.html#pragma_journal_mode