i have postgresql table field automatic timestamp field (set default current_timestamp
). field microsecond precision. possible have rows same timestamp or postgresql's concurrency control impose serial ordering on object updates?
yes. if use clock_timestamp()
new timestamp each time, , if you're on system microsecond timer precision, collisions likely.
microsecond timer precision doesn't mean microsecond timer accuracy or resolution. clock advances in "jumps". on systems jumps sub-microsecond (μs) , invisible applications work @ microsecond timer resolutions postgresql. on systems can tens or hundreds of milliseconds (ms)!
on ms windows prior introduction of getsystemtimepreciseasfiletime
in windows 8 , server 2012 (and adoption postgresql 9.5) time limited 1 millisecond (ms) resolution, , typically 15ms resolution! it's extremely same time value multiple calls on system except idle.
on modern linux, or on modern windows recent postgresql, collisions less due sub-millisecond timer resolution. they're still possible. if choose use timestamp unique key app must able retry if gets unique violation.
Comments
Post a Comment