Hi!

On Oct 21, Mads Kristensen wrote:
> *snip*
> > Yes.
> > B-tree is always balanced: http://www.nist.gov/dads/HTML/btree.html
> > 
> > Regards,
> > Sergei
> *snip*
> 
> You are right, B+Trees are always balanced but.... When you insert in
> increasing order all your inserts will be to the last leaf of the
> B+tree. This means that you can get some concurrency problems when
> updating the index since it is always the same part of the index that
> needs to be locked. 
> 
> I'm not quite sure how MySQL does it locking, but if it locks only the
> index leafs that it is updating this kind of insertion will give poor
> performance compared to random insertion.

MyISAM uses table-level locks, so it always lock the complete index for
writes.

On the other hand, always writting to the last leaf, you constantly
touch only few nodes - on the path from the root to the last leaf. Thus
these nodes/keypages will be always cached and the performance should be
somewhat better as compared to random accesses (assuming the index is
too big to fit in cache completely).
 
Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/  www.mysql.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to