3

How can I get last tuple in space? Last tuple here is tuple with max primary key value

 local a = box.space.SPACE:len()
 box.space.SPACE:get{a}

This variant is not suitable because the number of tuples is not equal to the number of created indexes

AlexZhur
  • 41
  • 5

1 Answers1

2

The best way to get last tuple in your case is box.space.X.index[0]:max() or box.space.X.index[0]:select({MAX_INT}, {limit=1, iterator='LE"})[1], if you prefer...