Some experience with timestamp data types

Timestamp is an important dimension in database (whether structured or semi-structured, unstructured), so how to decide what type of timestamp is.

The pros and cons of timestamp types

  Advantage disadvantage
long (unix timestamp)

low storage space

easy to calculate

High processing efficiency

Data is not intuitive

need to be converted when displayed

Text type (various Formats)

Data is intuitive and easy to read

The positioning problem is that no additional coding is required

Can be directly used as display (space for time)

Large storage space

Inconvenient to do rule calculation

Inefficient text processing

 

To sum up: when the background algorithm processes the scene, in order to save space, we tend to suggest that you use the long integer type;

When used to interact with the interface, and when there is enough space, I tend to recommend that you use the text type.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324932723&siteId=291194637