| Tarantool
Check out the new release policy
Submodule[, {options}])
box.schema.create_space(space-name[, {options}])

Create a space.

  • space-name (string) – name of space, which should conform to the rules for object names
  • options (table) – see “Options for” chart, below

space object



You can use either syntax. For example, s ='tester') has the same effect as s = box.schema.create_space('tester').

Options for

Name Effect Type Default
engine ‘memtx’ or ‘vinyl’ string ‘memtx’
field_count fixed count of fields: for example if field_count=5, it is illegal to insert a tuple with fewer than or more than 5 fields number 0 i.e. not fixed
format field names and types: See the illustrations of format clauses in the space_object:format() description and in the example. Optional and usually not specified. table (blank)
id unique identifier: users can refer to spaces with the id instead of the name number last space’s id, +1
if_not_exists create space only if a space with the same name does not exist already, otherwise do nothing but do not cause an error boolean false
is_local space contents are replication-local: changes are stored in the write-ahead log of the local node but there is no replication. boolean false
is_sync any transaction doing a DML request on this space becomes synchronous boolean false
temporary space contents are temporary: changes are not stored in the write-ahead log and there is no replication. Note re storage engine: vinyl does not support temporary spaces. boolean false
user name of the user who is considered to be the space’s owner for authorization purposes string current user’s name

Saying box.cfg{read_only=true...} during configuration affects spaces differently depending on the options that were used during, as summarized by this chart:

Option Can be created? Can be written to? Is replicated? Is persistent?
(default) no no yes yes
temporary no yes no no
is_local no yes no yes

There are three syntax variations for object references targeting space objects, for example will drop a space. However, the common approach is to use functions attached to the space objects, for example space_object:drop().


tarantool> s ='space55')
tarantool> s ='space55', {
         >   id = 555,
         >   temporary = false
         > })
- error: Space 'space55' already exists
tarantool> s ='space55', {
         >   if_not_exists = true
         > })

After a space is created, usually the next step is to create an index for it, and then it is available for insert, select, and all the other functions.