Table of contents


CrateDB is eventually consistent. Data written with a former statement is not guaranteed to be fetched with the next following select statement for the affected rows.

If required one or more tables can be refreshed explicitly in order to ensure that the latest state of the table gets fetched.

cr> refresh table locations;
REFRESH OK, 1 row affected (... sec)

A table is refreshed periodically with a specified refresh interval. By default, the refresh interval is set to 1000 milliseconds. The refresh interval of a table can be changed with the table parameter refresh_interval (see refresh_interval).

Multiple Table Refresh

If needed, multiple tables can be defined comma-separated in a single SQL request. This ensures that they all get refreshed and so their datasets get consistent. The result message is printed if the request on every given table is completed.

cr> REFRESH TABLE locations, parted_table;
REFRESH OK, 2 rows affected (... sec)


If one or more tables or partitions do not exist, none of the given tables/partitions are refreshed and an error is returned. The error returns only the first non-existent table/partition.

Partition Refresh

Additionally it is possible to define a specific PARTITION of a partitioned table which should be refreshed (see Partitioned tables).

By using the PARTITION clause in the refresh statement a separate request for a given partition can be performed. That means that only specific partitions of a partitioned table are refreshed. For further details on how to create a refresh request on partitioned tables see the SQL syntax and its synopsis (see REFRESH).

cr> REFRESH TABLE parted_table PARTITION (day='2014-04-08');
REFRESH OK, 1 row affected (... sec)

In case the PARTITION clause is omitted all partitions will be refreshed. If a table has many partitions this should be avoided due to performance reasons.