Tarantool CE/EE Documentation portal logo
Support
Updated at July 17, 2026   02:08 PM

index_object:min()

index_object method min([key])

Find the minimum value in the specified index.

Parameters:

  • index_object (index_object) — an object reference.

  • key (scalar/table) — values to be matched against the index key

Returns

the tuple for the first key in the index. If the optional key value is supplied, returns the first key that is greater than or equal to key. Starting with Tarantool 2.0.4, index_object:min(key) returns nothing if key doesn't match any value in the index.

Return type

tuple

Possible errors:

  • Index is not of type 'TREE'.
  • ER_TRANSACTION_CONFLICT if a transaction conflict is detected in the MVCC transaction mode.

Complexity factors: Index size, Index type.

Example:

Below are few examples of using min. To try out these examples, you need to bootstrap a Tarantool database as described in Using data operations.

-- Insert test data --box.space.bands:insert { 1, 'Roxette', 1986 }box.space.bands:insert { 2, 'Scorpions', 1965 }box.space.bands:insert { 3, 'Ace of Base', 1987 }box.space.bands:insert { 4, 'The Beatles', 1960 }box.space.bands:insert { 5, 'Pink Floyd', 1965 }box.space.bands:insert { 6, 'The Rolling Stones', 1962 }box.space.bands:insert { 7, 'The Doors', 1965 }box.space.bands:insert { 8, 'Nirvana', 1987 }box.space.bands:insert { 9, 'Led Zeppelin', 1968 }box.space.bands:insert { 10, 'Queen', 1970 }-- Find the minimum value in the specified indexmin = box.space.bands.index.year:min()--[[---- [4, 'The Beatles', 1960]...--]]-- Find the minimum value that matches the partial key valuemin_partial = box.space.bands.index.year_band:min(1965)--[[---- [5, 'Pink Floyd', 1965]...--]]