Options

How to convert numeric value stored in histogram data to timestamp

HibikiHibiki Vertica Employee Employee

In "Customer Use Cases" part of "Tuning Vertica for Performance at Scale" session in Vertica Unify 2021, I show you the example of the histogram data stored in Vertica to explain why the query plan indicates PREDICATE VALUE OUT-OF-RANGE. That histogram data is for the timestamp data type. Even if the data type is the timestamp, Vertica handles that histogram data as the numeric value. So you need to convert the numeric value to the timestamp value to know the actual value.

To convert it, use:

SELECT to_timestamp_tz((<Value in histogram data> / 1000000) + 946684800);
Tagged:
Sign In or Register to comment.