box.space._space_sequence | Tarantool
Submodule box.space box.space._space_sequence

box.space._space_sequence

box.space._space_sequence

_space_sequence is a system space. It contains connections between spaces and sequences.

Tuples in this space contain the following fields:

  • id (unsigned) – space id
  • sequence_id (unsigned) – id of the attached sequence
  • is_generated (boolean) – true if the sequence was created automatically via a space:create_index('pk', {sequence = true}) call
  • field (unsigned) – id of the space field to which the sequence is attached.
  • path (string) – path to the data within the field that is set using the attached sequence.

The system space view for _space_sequence is _vspace_sequence.

Example

-- Create a sequence --
box.schema.sequence.create('id_seq',{min=1000, start=1000})
-- Create a space --
box.schema.space.create('customers')

-- Create an index that uses the sequence --
box.space.customers:create_index('primary',{ sequence = 'id_seq' })

-- Create a space --
box.schema.space.create('orders')

-- Create an index that uses an auto sequence --
box.space.orders:create_index( 'primary', { sequence = true })

-- Check the connections between spaces and sequences
box.space._space_sequence:select{}
--[[
---
- - [512, 1, false, 0, '']
  - [513, 2, true, 0, '']
...
--]]
Found what you were looking for?
Feedback