Delete Multi Tuples in One Shot

140 views
Skip to first unread message

Mai Abdel-Qader

unread,
Jan 16, 2018, 1:47:01 AM1/16/18
to Tarantool discussion group (English)
Hello,

Can I delete multiple tuples in one shot?

-- Get minimum ID.
local min_id = box.space.dispatch_logs.index.primary:min()['id']


-- Get the minimum 1000 tuples.
result = box.space.dispatch_logs.index.primary:select(min_id, {iterator = box.index.GE, limit=1000})

Then I delete the result after getting it. How can I delete it one shot? Currently, I am doing this:

for key, value in ipairs(result) do
    box.space.dispatch_logs.index.primary:delete(value['id'])
end

I think there should be a better way that my way to delete them in one shot. Is there?

Thanks a lot,
Mai

Konstantin Osipov

unread,
Jan 16, 2018, 6:35:33 AM1/16/18
to tara...@googlegroups.com
* Mai Abdel-Qader <mai.abd...@gmail.com> [18/01/16 11:11]:

> Can I delete multiple tuples in one shot?

No, currently there is not. We ship luafun on board, so you could
use it to make deletion syntax a little less verbose.

We are adding SQL to Tarantool 1.8 to solve this and a zillion of
other problems.


--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.org - www.twitter.com/kostja_osipov
Reply all
Reply to author
Forward
0 new messages