2011/11/10 Richard Hipp <d...@sqlite.org>

>
> Because when you are inserting the Nth row, SQLite has no idea of how many
> more rows will follow or how big the subsequent rows will be, so it has no
> way to reserve contiguous space sufficient to hold them all.  The result is
> that parts of the table and parts of the indices become interleaved in the
> file.
>
>
But nothing is written to disk until I call commit (i'm using
journal_mode=memory), so when SQLite has to start writing the data, it
knows the exact total number of rows, and also that no other rows will
follow.

But then again, maybe the format of the journal in memory, is an exact copy
of the bytes it will write to disk, and in that case I understand that it
would be very inefficient to start shuffling things, instead of just
dumping it. I pictured it like a temporary table, in which case it would be
fairly easy to restructure things before writing.

Thanks for your explanation!
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to