frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Looking Forward to Postgres 19: It's About Time

https://www.pgedge.com/blog/looking-forward-to-postgres-19-its-about-time
51•xngbuilds•2h ago

Comments

munk-a•1h ago
It can be super ugly to try and hand-manage date time range manipulation in a system with moving parts. It is, of course, possible, but it's a headache to try and pull it off when there is complex business logic focused on those datetimes and interactions between ranges. The period constraint is an excellent tool for trivially guaranteeing range coverage (in a case where, for instance, a customer is known to be active from a to b it helps ensure that there aren't any gaps created during the juggling of different sub-ranges) while the new DELETE FOR PERIOD OF syntax makes manipulating swathes of history (I don't care what was happening here this interval should now be X) much more trivial than before.
bhaak•52m ago
I remember reading about this feature for Oracle in the 2000s and was always interested to use it in a production environment.

It never came to pass when we used Oracle, maybe now with Postgres I will finally have a chance at it.

larsnystrom•45m ago
Why are they storing a time period (start and end date) in the first example? Why not just store the date when the price comes into effect? That would make both overlaps and time travel impossible without using any constraints.
quotemstr•41m ago
It's a trade-off. If you store both endpoints you can continue to think of rows as order-invariant tuples. If you store only one endpoint, you have to impose a meaningful order on the rows in order for them to make sense.
larsnystrom•28m ago
Sure, from a theoretical perspective, but in practice there’s got to be some sort of order at some point even when storing timespans.
throwaway7783•41m ago
Works when there is always an active price. Having an explicit end date allows certain rows to be inactive automatically after validity period. Think of seasonal categories/products etc which dont exist after a specific period
larsnystrom•30m ago
You could also make the price column nullable and just insert a row with price null and the date from which there should be no price.
promano•24m ago
And even if you don't have seasonal products, you still need an end date to mark when you stop selling a product; otherwise you have to do something hacky like defining "<price> = NULL means we stopped selling the product after <valid_from>" and inserting an extra record.

I think the end date should be nullable though, but valid_to is NOT NULL in the starting example... later in the article, when showing the "new way" using date ranges, it inserts a row with an open-ended range, which is more what I'd expect.

evdubs•44m ago
> Recently, a new type of question has entered the database arena: what did this data look like last Tuesday?

This question has been answerable in Dolt for years now.

quotemstr•39m ago
This kind of DB isn't really answering this question. There's a lot more subtlety to time-span analysis than snapshotting. In particular, aligning two series is non-obvious.

Say you have one time series with CPU-core task switches:

T=1 task=A T=3, task=B, T=5 task=A, ...

... and another of CPU frequency changes ...

T=2 freq_hz=800, T=5 freq_hz=1200, T=6 freq_hz=900

How, in SQL, do you express the question "How many CPU cycles did each task use?"? Try to do it with more complex examples. You'll tear your hair out.

Having worked on this sort of data analysis quite a lot, I'm strongly of the opinion that SQL needs syntax, not just table-valued functions, for expressing questions about timelines.

evdubs•35m ago
The cool thing about Dolt is that you [eventually] get the features of the databases (MySQL, PostgreSQL, SQLite, MongoDB) they emulate, so you can have your PG 19 temporality features as well as branching and merging.
quotemstr•33m ago
Yep. I'm just pointing out that the problems Dolt solves are different from the problems a timeline-aware SQL algebra solves.
quotemstr•42m ago
Great! I've been wanting native time-based tables for ages. Years and years ago, I even wrote my own DB engine to get them!

See https://dancol.org/dctv/index.xml

I still think there's a lot of value in first-class syntax for time queries. Splitting ranges like Postgres 19 does is a good first step, but there's also a lot of power in broadcasting over these ranges, combining them in various ways, and storing multiple, independent ranges in a single table.

Ignore the bit about active development: these days, it'd take more sense to add the operators I describe to Postgres and DuckDB than to make a numpy-based engine just to host the analysis. This work predates DuckDB, and it's reassuring that DuckDB (and now Postgres) are thinking along similar lines.

I'm also glad that in the intervening years "data lake"-style analysis has become more prominent. My ideal data processing pipeline consists of sourcing from raw data and pipelining views all the way to human-meaningful outputs. Materialization, if it occurs, is just an optimization.

IgorPartola•26m ago
This is something that is incredibly useful. I built a system like this a while back that also adds versioning to each time period. The use case is this: let’s say you are tracking your state’s sales tax rate. You do not control this and data entry is manual so it is error prone. The rate is updated typically annually but sometimes more frequently.

Let’s say for 2026 you have it at 7.25% and you entered that into the system ahead of time (say December 2025). Today, June 12 you learn that it should have been 7.35%. It would be incorrect to say that the rate changed today: it was 7.35% since January 1. But you also don’t want to lose the fact that all your invoices have been generated using the wrong rate because if you go to recalculate them you will get a different answer.

In this case what you do is create version 2 of the rate in your database with the same time period but the correct rate. This would allow your other database objects to reference either version 1 or 2 and to even recalculate all the objects that reference version 1 to now reference version 2 such that you can get line item corrections and figure out what to do about them.

It is cumbersome to use but for the specific use case of modeling real world laws that are not available as machine-readable info it is the best option I came up with.

cherryteastain•10m ago
Very useful feature for trading systems where the exchange might tell you your order got filled but then send a trade correction or bust message
jacques_chester•9m ago
Exciting. Honestly I expect this will do more to advance bitemporal design than decades of jawboning has.

And really, ranges are an amazing substrate for this. I've had to do this by hand in a ... less featuresome ... SQL-speaking DB and it was clunky and performed fairly unimpressively.

CRISPR tech selectively shreds cancer cells, including "undruggable" cancers

https://innovativegenomics.org/news/crispr-technique-selectively-shreds-cancer-cells/
333•gmays•3h ago•85 comments

I Am Not a Reverse Centaur

https://blog.miguelgrinberg.com/post/i-am-not-a-reverse-centaur
53•ibobev•56m ago•15 comments

How to Setup a Local Coding Agent on macOS

https://ikyle.me/blog/2026/how-to-setup-a-local-coding-agent-on-macos
32•kkm•1h ago•8 comments

A PDF that changes based on how its read

https://sgaud.com/texts/pdf
64•SarthakGaud•2h ago•29 comments

Slightly reducing the sloppiness of AI generated front end

https://envs.net/~volpe/blog/posts/reduce-slop.html
113•FergusArgyll•4h ago•68 comments

Pirates, a naval warfare game inspired by Sid Meier's Pirates

https://piwodlaiwo.github.io/pirates/
33•iweczek•1h ago•9 comments

Looking Forward to Postgres 19: It's About Time

https://www.pgedge.com/blog/looking-forward-to-postgres-19-its-about-time
51•xngbuilds•2h ago•16 comments

Where Did Earth Get Its Oceans? Maybe It Made Them Itself

https://www.quantamagazine.org/where-did-earth-get-its-oceans-maybe-it-made-them-itself-20260612/
63•ibobev•3h ago•39 comments

A dumpster arrived behind my university's library

https://yalereview.org/article/sheila-liming-the-end-of-books
110•mooreds•4h ago•79 comments

Malware developers added nuclear and biological weapons text to to their spyware

https://twitter.com/jsrailton/status/2064661778978533571
95•marc__1•22h ago•75 comments

Tesla Full Self Driving uses bicycle lane in official Denmark approval video

https://politiken.dk/danmark/forbrug/biler/art10875514/Allerede-12-sekunder-inde-i-PR-videoen-beg...
60•Veserv•59m ago•15 comments

Launch HN: BitBoard (YC P25) – Analytics Workspace for Agents

https://bitboard.work/
15•arcb•1h ago•4 comments

Cosmodial Sky Atlas

https://killedbyapixel.github.io/Cosmodial/
6•memalign•29m ago•0 comments

Keygen.music

https://keygen.music
94•soupspaces•3h ago•56 comments

There Is Life Before Main in Rust

https://grack.com/blog/2026/06/11/life-before-main/
26•mmastrac•1d ago•7 comments

I Won't Buy You a Coffee

https://hakkerman.eu/blog/i-wont-buy-you-a-coffee/
3•speckx•11m ago•0 comments

Hazel (YC W24) Is Hiring a Full Stack Engineer

https://www.ycombinator.com/companies/hazel-2/jobs/3epPWgu-full-stack-engineer-ts-sci
1•augustschen•5h ago

Maxproof

https://arxiv.org/abs/2606.13473
108•ilreb•6h ago•8 comments

AI agent bankrupted their operator while trying to scan DN42

https://lantian.pub/en/article/fun/ai-agent-bankrupted-their-operator-scan-dn42lantian.lantian/
1297•xiaoyu2006•14h ago•472 comments

Introduction to UEFI HTTP(s) Boot with QEMU/OVMF

https://blog.yadutaf.fr/2026/06/12/introduction-to-uefi-https-boot-qemu-ovmf/
32•jtlebigot•3h ago•7 comments

A Call to Action: Stop the FCC's KYC Regime

https://blog.lopp.net/call-to-action-stop-the-fcc-kyc-regime/
264•FergusArgyll•4h ago•167 comments

Law Enforcement's "Warrior" Problem (2015)

https://harvardlawreview.org/forum/vol-128/law-enforcements-warrior-problem/
21•bookofjoe•1h ago•10 comments

WASI 0.3

https://bytecodealliance.org/articles/WASI-0.3
191•mavdol04•4h ago•76 comments

"Don't You Just Upload It to ChatGPT?"

https://correresmidestino.com/dont-you-just-upload-it-to-chatgpt/
66•speckx•56m ago•68 comments

If you are asking for human attention, demonstrate human effort

https://tombedor.dev/human-attention-and-human-effort/
1371•jjfoooo4•19h ago•438 comments

New privacy frontier: Europe eyes crackdown on smart glasses

https://www.politico.com/www.politico.eu/article/new-privacy-frontier-europe-eyes-crackdown-smart...
41•1vuio0pswjnm7•2h ago•22 comments

Show HN: StackScope – I crawled over 40k indie launches to see what they ship

https://stackscope.dev/
23•datafreak_•3h ago•6 comments

Show HN: Script to bulk delete Claude chats from the web UI

https://github.com/MatteoLeonesi/bulk-delete-claude-chat
40•ML0037•3h ago•14 comments

Encrypted Spaces An architecture for collaborative applications

https://encryptedspaces.org/
42•_____k•6h ago•5 comments

How we made hit video game Prince of Persia

https://www.theguardian.com/culture/2026/jan/05/raiders-of-the-lost-ark-hit-video-game-prince-of-...
244•msephton•2d ago•92 comments