On Wed, 24 Feb 2016 12:53:48 +0000
Simon Slavin <slavins at bigfraud.org> wrote:

> In case you're new to this group, please understand that I'm
> experienced with SQLite and I understand how it works and how it uses
> journal files.
> 
> Can someone explain to me -- or point at a web page which does -- why
> a separate journal file is needed.  Why can't the information which
> SQLite stores in a journal file be put in the database file ?  Given
> how SQLite structures its database files this would presumably mean
> that the main database would have journal pages as well as table and
> index pages.  Or that there would be 'stable' table and index pages
> and 'journal' table and index pages. 

There are two too bad side effects putting the journal file inside the database 
(at end, in the middle, at begining, no matter).

a) If you add the journal at the end of the db file, and insert new data, it 
probably will be after the journal. When checkpointing or commiting the journal 
pages converts to empty pages, quickly filled with new data on next commit, but 
making internal data fragmentation worse.

b) Modify fs i-nodes and directory db file information. These are delicate 
structures and, on a crash or a file system problem, there are bigger chances 
to corrupt them if you are continuosly modifying them. Where is the journal 
data if you or the fs can't find the end of the db file?. Better is modify 
i-nodes and directory metadata only when needed.

Of course, b) is unlikely, but a) is a real pita.

> Simon.

---   ---
Eduardo Morras <emorrasg at yahoo.es>

Reply via email to