New answers tagged


I think you're on the right track with AtomicLong, but you'd have to run a scan operation each time your app starts to determine which value to start at. You'd want to test this to ensure it doesn't degrade performance too much. Another option is a metadata item. You could create an additional table for this, or you could add an item to your existing table ...


Seems like you are storing milliseconds since 1970-01-01 00:00:00 so Adam's answer is right. Another way would be to use interval addition to the 'epoch' timestamp (which is 1970-01-01 00:00:00): select timestamptz 'epoch' + 1462975819250 * interval '1 millisecond' as my_timestamp ; Tested: test=# select timestamptz 'epoch' + 1462975819250 * ...


to_timestamp() expects the parameter to be given in seconds. Your value is in miliseconds. Just divide it by 1000: SELECT to_timestamp(1462975819.250); gives 2016-05-11 16:10:19.25+02

Top 50 recent answers are included