---
title: "How soon is now in PostgreSQL?"
url: https://daily.dev/posts/how-soon-is-now-in-postgresql--ttlfazctx
source_url: https://www.architecture-weekly.com/p/how-soon-is-now-in-postgresql
type: article
source: "Architecture Weekly"
published: 2026-05-25T12:35:44.663Z
updated: 2026-05-25T12:36:10.044Z
tags: ["testing", "architecture", "postgresql"]
reading_time: 11
upvotes: 39
comments: 3
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How soon is now in PostgreSQL?

**[Architecture Weekly](https://daily.dev/sources/architectureweekly)** · 11 min read · 39 upvotes · 3 comments

## Summary

PostgreSQL's now() function returns the transaction start time, not the current wall clock time — it stays frozen for the entire duration of a transaction. This caused a subtle bug in distributed locking logic inside the Emmett framework, where a retry loop wrapping multiple calls to a stored procedure all ran inside one transaction. Because now() never advanced, a timeout predicate checking whether a previous processor owner had gone stale always evaluated the same way, making retries useless. The fix was to use clock_timestamp() instead, which reads the actual wall clock on every call regardless of transaction boundaries. The post also reflects on why existing tests missed the bug: unit-level stored procedure tests never combined a retry policy with stale-row state, and end-to-end tests didn't hit the specific combination of crash, new instance ID, and retry timeout. The lesson is to write tests at the seam where the inner test invokes code differently from how production actually drives it.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.architecture-weekly.com/p/how-soon-is-now-in-postgresql>

## Community discussion

Top comments from developers on daily.dev.

**@andrewvaz** · 3 upvotes

> To me now() should have been named start__transaction__timestamp() (or something like that). This gave me some headaches when I migrated from other databases, until I discovered this small PG "feature".

**@s\_pellegrino** · 0 upvotes

> Yes, I like The Smiths too...

## Similar posts on daily.dev

- [PostgreSQL as a temporal database](https://daily.dev/posts/postgresql-as-a-temporal-database-ypp4bfcv5) · Planet PostgreSQL · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#architecture](https://daily.dev/tags/architecture), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/how-soon-is-now-in-postgresql--ttlfazctx)
