1

I'm currently setting up a database to populate it with big data. All the data I get comes from Valve's Steam Web API. Therefore, as all timestamps are returned in Unix timestamps, I cannot directly derive the correct timezone - which is also not of any interest as it's to fine-grained for what it is intended for. However, PostgreSQL enables the "length"-value field when setting the column up for timestamp without timezone but I don't know which value is meaningful to enter here and I also couldn't find any information about this value - neither in the official documentation nor on StackExchange so far.

As I'm someone who doesn't set up databases all the time I'm a bit confused and would love to get some assistance. Thanks in advance for your suggestions and input.

1
1

It's not the "length", it's the precision of the timestamp, so it controls the fractional seconds (milliseconds, microseconds) you can store.

e.g. '2020-12-14 23:14:10.123456'::timestamp(0) returns 2020-12-14 23:14:10 and '2020-12-14 23:14:10.123456'::timestamp(3) returns 2020-12-14 23:14:10.123

As you get a unix epoch which has no fractional seconds, timestamp(0) should be OK.

But in the end it doesn't matter, as changing the precision doesn't change the storage requirements. It's always 8 byte regardless of the precision you choose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.