MySQL Forums
Forum List  »  Memory Storage Engine

Re: Why Index Lengh grow up
Posted by: Ingo Strüwing
Date: October 17, 2005 10:59AM

Sorry for the late reply. I was on vacation.

In mysys/tree.c I found:

in tree_insert():

uint alloc_size=sizeof(TREE_ELEMENT)+key_size+tree->size_of_element;
tree->allocated+=alloc_size;

and in tree_delete():

/* This doesn't include key_size, but better than nothing */
tree->allocated-= sizeof(TREE_ELEMENT)+tree->size_of_element;

The problem is that we do not know the key size in tree_delete(). I guess that the original author thought that the performance impact of a strlen() was not worth it for tables which were initially meant for short time life.

One can see this as a bug. If you like you can file a bug report on bugs.mysql.com.

Preliminarily you can workaround like so:

- If you sometimes have to delete *all* records, use TRUNCATE TABLE instead.
or
- Use an ALTER TABLE command which re-creates the table from time to time.

Options: ReplyQuote


Subject
Views
Written By
Posted
8786
October 02, 2005 11:43PM
4440
October 09, 2005 10:40PM
4362
October 10, 2005 07:29PM
Re: Why Index Lengh grow up
4060
October 17, 2005 10:59AM
4296
April 05, 2006 02:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.