# Occasionally injected clocks in Postgres

DevFeed: [Occasionally injected clocks in Postgres](<https://devfeed.tech/articles/occasionally-injected-clocks-in-postgres-53032.md>)

Original publisher: [Read original article](<https://brandur.org/fragments/postgres-clocks>)

Author: Brandur Leach

Published: 2025-06-29T17:48:16Z

Content type: article

Language: en

Sources: [Fragments -- brandur.org](<https://devfeed.tech/sources/fragments-brandur-org.md>)

Topics: [Database](<https://devfeed.tech/topics/database.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [test](<https://devfeed.tech/topics/test.md>), [consistency](<https://devfeed.tech/topics/consistency.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [Parameter](<https://devfeed.tech/topics/parameter.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [database](<https://devfeed.tech/tags/database.md>), [go](<https://devfeed.tech/tags/go.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [sql](<https://devfeed.tech/tags/sql.md>), [tests](<https://devfeed.tech/tags/tests.md>)

## AI overview

The article discusses using a shared PostgreSQL database clock to maintain timestamp consistency across horizontally scaled application nodes, while injecting timestamps when tests need controllable time. It presents a hybrid approach implemented in Go and notes tradeoffs involving transaction-level time semantics and timestamp accuracy.

## Source excerpt

Using a coalescable parameter to stub time as necessary in tests, but otherwise use the shared database clock across all operations.