Thanks for the quick reply.
Yes, this is one of the approach we can go with, but there is one drawback with this approach. The time for executing in 1 iteration will keep on increasing as the offset increases (not suitable for large dataset). Reason lies in how the OFFSET queries are getting processed.
The better query would be
key=''
repeat untill !result
result = SELECT meta().id FROM bucket WHERE meta().id > $key LIMIT 1000000;
key = result[last_key]
done