purge
Purges table data for a specified date range at the time the overall query starts. Typically used when you want to purge existing data and load new data each time a query runs.
Command properties
| Item | Description |
|---|---|
| Command type | Processing query |
| Required permission | Administrator |
| License usage | N/A |
| Parallel execution | Not supported |
| Distributed execution | Not supported |
Syntax
Options
from=STR- Start date for the purge range, in
yyyyMMddformat. to=STR- End date for the purge range, in
yyyyMMddformat. TABLE[, ...]- Names of the tables to purge, separated by commas. Wildcards (
*) are supported.
Error codes
Parse errors
| Error code | Message | Description |
|---|---|---|
| 11400 | The procedure cannot be found. | The user does not have administrator permission |
| 11401 | Incomplete expression. | The command string ends with a comma (,) |
| 11402 | Enter the start date. | The from option is not specified |
| 11403 | Enter the end date. | The to option is not specified |
| 11404 | Invalid date expression: [msg]. | The value of the from or to option is not in yyyyMMdd format or is an invalid date |
| 11405 | The [table] table does not exist. | The specified table does not exist |
| 11406 | Invalid date range. | The from date is later than the to date |
Runtime errors
N/A
Description
The purge command purges table data for the specified date range at query start (onStart). The data purge is performed once at query start, independently of record processing in the query pipeline.
Because purge is a processing query, it requires a driver query preceding it to generate data. It passes input records to the next command unchanged without modifying them.
Wildcards are supported in table names, and multiple tables can be specified separated by commas. If no local table matches a wildcard pattern and the pattern is not optional (no ? suffix), a parse error occurs.
Examples
-
Purging table data and loading new data
table duration=1h raw_logs | purge from=20260301 to=20260317 summary_table | import summary_tablePurges data from March 1 to March 17, 2026 in
summary_table, then loads data retrieved from theraw_logstable intosummary_table. -
Purging data from multiple tables
json "{}" | purge from=20250101 to=20251231 web_logs,app_logsPurges all data from 2025 in the
web_logsandapp_logstables. -
Purging data using a wildcard
json "{}" | purge from=20250101 to=20250131 tmp_*Purges January 2025 data from all tables whose names start with
tmp_.