7.3.36. truncate

7.3.36.1. Summary

truncate command deletes all records from specified table.

7.3.36.2. Syntax

truncate command takes only one parameter.

The required parameter is only table:

truncate table

7.3.36.3. Usage

Here is a simple example of truncate command.

Execution example:

table_create Users TABLE_PAT_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
load --table Users
[
{"_key": "Alice",  "score": 2},
{"_key": "Bob",    "score": 0},
{"_key": "Carlos", "score": -1}
]
# [[0, 1337566253.89858, 0.000355720520019531], 3]
select Users
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         3
#       ],
#       [
#         [
#           "_id",
#           "UInt32"
#         ],
#         [
#           "_key",
#           "ShortText"
#         ]
#       ],
#       [
#         1,
#         "Alice"
#       ],
#       [
#         2,
#         "Bob"
#       ],
#       [
#         3,
#         "Carlos"
#       ]
#     ]
#   ]
# ]
truncate Users
# [[0, 1337566253.89858, 0.000355720520019531], true]
select Users
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         0
#       ],
#       [
#         [
#           "_id",
#           "UInt32"
#         ],
#         [
#           "_key",
#           "ShortText"
#         ]
#       ]
#     ]
#   ]
# ]

7.3.36.4. Parameters

This section describes parameters of truncate.

7.3.36.4.1. Required parameter

There is required parameter, table_name.

7.3.36.4.1.1. table_name

It specifies the name of table.

7.3.36.5. Return value

[HEADER, SUCCEEDED_OR_NOT]

HEADER

See Output format about HEADER.

SUCCEEDED_OR_NOT

If command succeeded, it returns true, otherwise it returns false on error.