Skip to content
Snippets Groups Projects
user avatar
Konstantin Osipov authored
Fix bug https://bugs.launchpad.net/tarantool/+bug/990728
"box.space:truncate() is a CPU hog".

The old truncate algorithm would restart iteration
from the beginning to delete every tuple.
With HASH index it was especially slow, since
it would have to skip more and more empty slots
to find a non-empty slot for deletion.

Rewrite the truncate() to walk linearly
over all elements and delete them.

This works both with HASH and TREE indexes.

On the same token make truncate multipart-index
aware (was missed in multipart-pk patch).
Add a test for that.

To work with multipart keys efficiently,
implement tuple:slice(). A slice returns
a linear set of fields from a tuple.
Convenient to retreive a multipart key or
tuple tail. Document tuple:slice().
39d92ffe
History
Name Last commit Last update