Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua Tarantool:索引中的限制/偏移量。indexName:成对调用_Lua_High Load_Tarantool_Nosql - Fatal编程技术网

Lua Tarantool:索引中的限制/偏移量。indexName:成对调用

Lua Tarantool:索引中的限制/偏移量。indexName:成对调用,lua,high-load,tarantool,nosql,Lua,High Load,Tarantool,Nosql,我需要从space用户那里获取一些记录。 此空间有一个辅助索引类别\状态\评级。 我需要选择具有category=1,status=1,rating的用户,而不是使用偏移量,如果您确实需要,您可以保存您的位置(将是最后检查的元组)。 e、 g: 或者,使用luafun(其中,drop\u n模拟限制,保存到last模拟偏移): ,也就是说。如果它符合你的要求,你为什么不试试呢?嗯。。。但是如果评级不是唯一的值怎么办?这是否意味着如果我将使用last作为位置,则前20条记录中的last记录可以位于

我需要从space
用户那里获取一些记录。
此空间有一个辅助索引
类别\状态\评级

我需要选择具有
category=1
status=1
rating的用户,而不是使用偏移量,如果您确实需要,您可以保存您的位置(将是最后检查的元组)。
e、 g:

或者,使用luafun(其中,
drop\u n
模拟限制,保存到
last
模拟偏移):


,也就是说。

如果它符合你的要求,你为什么不试试呢?嗯。。。但是如果
评级
不是唯一的值怎么办?这是否意味着如果我将使用
last
作为位置,则前20条记录中的
last
记录可以位于
second 20条记录中?然后您需要计算您处理的带有评级
last
的元组数,并且(例如)使用
drop\n
for _, user in box.space.users.index.category_status_rating:pairs({ 1, 1, 123456789 }, { limit = 20, offset = 5, iterator = box.index.LE }) do
    if user[categoryIdx] ~= 1 or user[statusIdx] ~= 1 then break end
    table.insert(users, user)
end
local last = 123456789
for i = 1, 2 do
    local count = 0
    for _, user in box.space.users.index.category_status_rating:pairs({1, 1, last}, { iterator = box.index.LE }) do
        if user[categoryIdx] ~= 1 or user[statusIdx] ~= 1 or count > 20 then
            break
        end
        table.insert(users, user)
        last = user[LAST_INDEX_FIELD]
        count = count + 1
    end
    -- process your tuples
end
local last = 123456789
for i = 1, 2 do
    local users = box.space.users.index.category_status_rating:pairs({1, 1, last}, { iterator = box.index.LE }):take_n(20):map(function(user)
        last = user[LAST_INDEX_FIELD]
        return user
    end):totable()
    -- process your tuples
end