13-bit millisecond timestamp vs MySQL Int (13)

Source: Internet
Author: User
Tags mysql version

Problem Description:

Requires storage of 13-bit millisecond-level timestamps, formatted as INT (13) in MySQL, overflow, auto-truncated to 2147483647

Analysis:

If you ask directly the scope of the int type of storage, it must be known, but the addition of the following (n) is confusing.

FIX: Modify to bigint (use MySQL version below 5.6.4)

Https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html

5.6.4 previously: millisecond-level timestamp storage not supported (DATETIME TIMESTAMP)

After 5.6.4: Can be stored by setting the number of decimal digits

Added

Knowledge Point One: what does n in int (n) mean? Display width

  • n represents the length of the display, the left padded space when insufficient
  • n does not affect the range that can be stored

Knowledge Point Two: What does N in VARCHAR and char mean?

CHAR (n): n max is 255, use size always n bytes;

VARCHAR (n): n maximum is 65535, the use of size is related to the actual length of the stored string;

13-bit millisecond timestamp vs MySQL Int (13)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.