On Wed, 10 Dec 2014 08:49:21 +0100
Eduardo Morras <[email protected]> wrote:

> > Why ORDER BY on INSERT?  Does it work better?  I would expect the
> > unnecessary sort to be pure overhead.  
> 
> If you insert in correct index order, the index update phase is
> faster because it don't need rebalance the b-tree so often after each
> insert.

OK, but at the cost of sorting the input first.  Rebalancing a tree
requires diddling a few pointers.  Sorting in the average case is 
O(log N), and possibly worse, plus the attendant I/O.  

--jkl

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to