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

- 日本語版はこちら

### Navigation

- index
- next |
- previous |
- Groonga v4.0.6.1 documentation »
- 7. Reference manual »
- 7.3. Command »

# 7.3.34. `truncate`

## 7.3.34.1. Summary

`truncate` command deletes all records from specified table.

## 7.3.34.2. Syntax

`truncate` command takes only one parameter.

The required parameter is only `table`:

    truncate table

## 7.3.34.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.34.4. Parameters

This section describes parameters of `truncate`.

### 7.3.34.4.1. Required parameter

There is required parameter, `table_name`.

#### 7.3.34.4.1.1. `table_name`

It specifies the name of table.

## 7.3.34.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.

### Navigation

- index
- next |
- previous |
- Groonga v4.0.6.1 documentation »
- 7. Reference manual »
- 7.3. Command »