Warning:
This version of CockroachDB is no longer supported. Cockroach Labs supports the current stable release and two releases prior. Please use one of these supported versions.

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:

copy
icon/buttons/copy
> SELECT * FROM t AS OF SYSTEM TIME '2016-01-01 08:00:00'
copy
icon/buttons/copy
> SELECT * FROM t AS OF SYSTEM TIME 1451635200000000000
copy
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