1

Let's suppose that i have space with tree indexes on field 1, 2 and {1,2} with following tuples:

  • [1, 1]
  • [2, 1]
  • [3, 1]
  • [4, 2]
  • [5, 2]
  • [6, 2]
  • [7, 3]
  • [8, 3]
  • [9, 3]

what is the fastest way to retrieve tuple with max value of field 1 and where field 2 is equal 2, AFAIK pairs doesn't support partial keys, so there is any way without iterating through partial select results?

1 Answers1

1

Composite index should have order {2, 1} then tuple with max value of 1st field and specific value of 2nd field can be selected by:

index:select({2}, {iterator='REQ',limit=1})[1]