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 the metadata is missing. It will return the number of columns rewritten.

This command can help recover data or access to a table that has been damaged by hardware or software failure. It will also upgrade the disk layout and compression routines to the latest available.

Note

There’s no guarantee a table can be fully repaired. REPAIR will replace unavailable data with NULL values.

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);