AS OF SYSTEM TIME

Warning:
As of November 10, 2018, CockroachDB v1.0 is no longer supported. For more details, refer to the Release Support Policy.

The AS OF SYSTEM TIME timestamp clause is available in some statements to execute them as of the specified time.

The timestamp argument supports various formats.

Format Notes
INT Nanoseconds since the Unix epoch.
STRING A TIMESTAMP or INT of nanoseconds.

Examples

Assuming the following statements are run at 2016-01-01 12:00:00, they would execute as of 2016-01-01 08:00:00:

icon/buttons/copy
> SELECT * FROM t AS OF SYSTEM TIME '2016-01-01 08:00:00'
icon/buttons/copy
> SELECT * FROM t AS OF SYSTEM TIME 1451635200000000000
icon/buttons/copy
> SELECT * FROM t AS OF SYSTEM TIME '1451635200000000000'

See Also

Tech Note

Note:
Although the following format is supported, it is not intended to be used by most users.

HLC timestamps can be specified using a DECIMAL. The integer part is the wall time in nanoseconds. The fractional part is the logical counter, a 10-digit integer. This is the same format as produced by the clutser_logical_timestamp() function.


Yes No