Storing microseconds in MySQL: which workaround?

后端 未结 3 1219
無奈伤痛
無奈伤痛 2021-02-20 13:48

we\'re writing a scientific tool with MySQL support. The problem is, we need microsecond precision for our datetime fields, which MySQL doesn\'t currently support. I see at leas

3条回答
  •  有刺的猬
    2021-02-20 14:42

    How about splitting the date parts into a date-only part, and microseconds from midnight? There are less than 2^64 microseconds in the day. Then cluster the table on {date, microsecond}.

    I would guess, though I don't know your data, that certain queries would be fine with day-level accuracy -- 'experiments in 1964' doesn't need to worry about microseconds.

提交回复
热议问题