10. Repair table#

10.1. Synopsis#

REPAIR TABLE { <table_name> | <find_expression> } [, ... ]

  IN { RANGE <range_spec> | '[' RANGE <range_spec> [, ...] ']' }
    [ WITH DAYS IN ( <day>, <day> ) ]
    [ WITH TIME IN ( <time>, <time> ) ]

range_spec ::=
  ( <timestamp>, <timestamp> )
  ( <timestamp>, <time_offset> )

find_expression ::=
  FIND ( { <tag_expression> | NOT <tag_expression> } [ AND ... ] )

tag_expression ::=
  TAG = 'tag_name'

10.2. Description#

REPAIR TABLE attempts to repair the specified table(s) buckets. System privileges and write privileges are required for the target tables.

The query will attempt to find the specified table(s) buckets even if metadata is missing. It will return the number of columns rewritten.

Note

Currently, only one mode is supported: REPAIR TABLE will load buckets matching the given parameters and save them in the latest format available. It will also unconditionally recompute the micro-index metadata. As such, REPAIR TABLE can upgrade the compression to the newest algorithm available, upgrade micro-indexes, and repair micro-indexes.

10.3. Parameters#

table_name

The name of the table to retrieve rows from.

find_expression

When your tables are tagged, you can use inline key/value lookups to perform your query over multiple tables. To match all tables that have the tag “stocks”, you can use FIND(tag='stocks' AND type=ts).

10.4. Examples#

Repair every bucket associated with the table example:

REPAIR TABLE example;

Repair every bucket associated with the table example for the year 2017:

REPAIR TABLE example IN RANGE(2017, 2018);

Repair every bucket associated with all tables taged with ‘nyse’ for the year 2017:

REPAIR TABLE FIND(tag='nyse') IN RANGE(2017, 2018);