On Mon, Jan 8, 2018 at 11:39 AM, x <tam118...@hotmail.com> wrote:
> However, I’m still confused. Reading this https://sqlite.org/
> queryplanner.html suggests the table is stored in RowID order. So what
> happens if I insert a record into Tbl with a lower ID than the existing 2.4
> million Ids?
It depends if your ID column is an alias for the ROWID special column or
ROWID is the key of the B-tree I believe, so if you insert a row "in the
many pages have potentially to be rewritten to "rebalance" the B-tree.
While only the "last" page needs updating with AUTO INCREMENT or a ROWID
larger than the previous larger one.
So if ID an alias for ROWID, the insert might be much more expensive.
If ID is not, then the row is simply "appended" at the end, "cheaply".
I could be wrong of course. I'll find out very soon :). --DD
sqlite-users mailing list