# groonga - An open-source fulltext search engine and column store.

- 日本語版はこちら

### Navigation

- index
- next |
- previous |
- groonga v3.0.8 documentation »
- 8. リファレンスマニュアル »
- 8.3. Command »

# 8.3.31. `truncate`

## 8.3.31.1. Summary

`truncate` command deletes all records from specified table.

## 8.3.31.2. Syntax

`truncate` command takes only one parameter.

The required parameter is only `table`:

    truncate table

## 8.3.31.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"
    #         ]
    #       ]
    #     ]
    #   ]
    # ]

## 8.3.31.4. Parameters

This section describes parameters of `truncate`.

### 8.3.31.4.1. Required parameter

There is required parameter, `table_name`.

#### 8.3.31.4.1.1. `table_name`

It specifies the name of table.

## 8.3.31.5. Return value

    [HEADER, SUCCEEDED_OR_NOT]

`HEADER`

> The format of HEADER is [0, UNIX_TIME_WHEN_COMMAND_IS_STARTED, ELAPSED_TIME]. See Output format about HEADER.

`SUCCEEDED_OR_NOT`

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

### Navigation

- index
- next |
- previous |
- groonga v3.0.8 documentation »
- 8. リファレンスマニュアル »
- 8.3. Command »