frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Pglocks.org

https://pglocks.org/
80•hnasr•9mo ago

Comments

whilenot-dev•9mo ago
I'm a bit lost here.

Locking is a challenging problem in complex systems. Is this list to be interpreted as a "TODO: get rid of locking conflicts in future releases" or more a "NOTE: be aware there are known conflicts that will not change - find ways to work around them"?

EDIT: Also, is the creation of this list an automated or a manual effort?

tux3•9mo ago
I think this is intended as educational material, not a list of things to fix.

The locks are here by necessity, it is not so easy at all to get rid of them. And even in special cases where it is possible, the complexity you have to introduce is not to be taken lightly...

If even a tenth of these disapppeared, it would be incredible, in a very surprising way.

atombender•9mo ago
The creator looks like a developer and teacher, not a Postgres core team member. So I assume this is for documentation purposes.

I actually like this a lot, as there isn't a single place in the Postgres documentation that lists all the possible locks; it's spread out all over. Having a quick reference for what kinds of commands you'd be blocking with your transaction is valuable.

It's pretty evident that the pages have been programmatically generated, but I'd love know what it's generated from. I think you can derive this information from the documentation, but not sure if you can do it in an automated way without an LLM.

braiamp•9mo ago
> there isn't a single place in the Postgres documentation that lists all the possible locks

Did you read this page? https://www.postgresql.org/docs/current/explicit-locking.htm...

atombender•9mo ago
That's a great page, but it has several issues.

First, it isn't complete; as I said, the locking behaviour is spread out all over the Postgres documentation. For example, that page doesn't list what locks DROP INDEX takes. To find that out, you have to go to the documentation page for that command and read it carefully. In fact, really carefully — the locking behaviour is only documented under the section about CONCURRENTLY.

The page also doesn't list what possible commands are then blocked. Locks interact in subtle (and incorrectly named!) ways that are explained in the tables on that page ("Conflicting lock modes"), so to understand if something will block something else you have to look at the two commands you are curious about and then look at how their locks interact.

gulcin_xata•9mo ago
I agree, it is not so straightforward to find out.
braiamp•9mo ago
These are database locks, which means that depending which arrives first, the later transaction has to wait till the first one finishes to complete. These locks are about SQL commands and which commands can run concurrently with the others. There's a graph here of how that looks like https://pankrat.github.io/2015/django-migrations-without-dow...

Usually for maximum performance (minimum latency, maximum throughput) you want to have operations not lock each other, unless absolutely necessary, in which case you want them to be short.

whilenot-dev•9mo ago
You make it sound like the conflict is just affecting performance and won't result in a deadlock. So it's for performance aware postgres clients/users, and not for postgres developers?
andyferris•9mo ago
It is a guide for developers using postgres as a client, who need to write systems that don't deadlock, are performant and are correct. These are the (rather sharp) tools that postgres provides for doing so (or else you can use e.g. serializable isolation and optimistic concurrency, but in my experience that has too many false positives and bail out rather eagerly, whereas these tools let you be very precise and granular).
mebcitto•9mo ago
Other relevant talks/blogs that I found really useful for understanding Postgres locks are:

* Unlocking the Postgres Lock Manager by Bruce Momjian: https://momjian.us/main/writings/pgsql/locking.pdf

* Anatomy of table-level locks by Gulcin Yildirim Jelinek: https://xata.io/blog/anatomy-of-locks

pasxizeis•9mo ago
Shameless plug: I wrote a tool[1] that executes a given migration against a test database (e.g. in your CI) and reports back what locks it acquired.

The rationale being to have a "lock diagnostics report" commented in your PR's migration file.

It's a prototype and has a few rough edges and missing functionality, but feedback is more than welcome.

[1] https://github.com/agis/pglockanalyze

jononor•9mo ago
Very practical! Locking is one of the things that can really bite when doing migrations.

Ki Editor - an editor that operates on the AST

https://ki-editor.org/
89•ravenical•3h ago•25 comments

Plasma Bigscreen – 10-foot interface for KDE plasma

https://plasma-bigscreen.org
503•PaulHoule•13h ago•154 comments

Tell HN: I'm 60 years old. Claude Code has re-ignited a passion

627•shannoncc•13h ago•488 comments

US economy sheds 92,000 jobs in February in sharp slide

https://www.ft.com/content/6542bd0c-59ca-493b-ab5d-2d69e4e00cae
69•doener•1h ago•3 comments

UUID package coming to Go standard library

https://github.com/golang/go/issues/62026
240•soypat•11h ago•158 comments

48x32, a 1536 LED Game Computer (2023)

https://jacquesmattheij.com/48x32-introduction/
30•duck•2d ago•2 comments

this css proves me human

https://will-keleher.com/posts/this-css-makes-me-human/
297•todsacerdoti•15h ago•95 comments

Helix: A post-modern text editor

https://helix-editor.com/
199•doener•13h ago•85 comments

Galileo's handwritten notes found in ancient astronomy text

https://www.science.org/content/article/galileo-s-handwritten-notes-found-ancient-astronomy-text
159•tzury•1d ago•31 comments

Working and Communicating with Japanese Engineers

https://www.tokyodev.com/articles/working-and-communicating-with-japanese-engineers
65•zdw•3d ago•28 comments

QGIS 4.0

https://changelog.qgis.org/en/version/4.0/
110•jonbaer•4h ago•21 comments

LLMs work best when the user defines their acceptance criteria first

https://blog.katanaquant.com/p/your-llm-doesnt-write-correct-code
286•dnw•12h ago•208 comments

Self-Portrait by Ernst Mach (1886)

https://publicdomainreview.org/collection/self-portrait-by-ernst-mach-1886/
4•Hooke•1d ago•0 comments

Lock Scroll with a Vengeance

https://unsung.aresluna.org/lock-scroll-with-a-vengeance/
28•etothet•3d ago•6 comments

Uploading Pirated Books via BitTorrent Qualifies as Fair Use, Meta Argues

https://torrentfreak.com/uploading-pirated-books-via-bittorrent-qualifies-as-fair-use-meta/
121•askl•4h ago•77 comments

Show HN: Moongate – Ultima Online server emulator in .NET 10 with Lua scripting

https://github.com/moongate-community/moongatev2
263•squidleon•23h ago•146 comments

Editing changes in patch format with Jujutsu

https://www.knifepoint.net/~kat/kb-jj-patchedit.html
39•cassepipe•3d ago•7 comments

Sarvam 105B, the first competitive Indian open source LLM

https://www.sarvam.ai/blogs/sarvam-30b-105b
99•logicchains•6h ago•26 comments

Modernizing swapping: virtual swap spaces

https://lwn.net/Articles/1059201/
39•voxadam•1d ago•33 comments

What canceled my Go context?

https://rednafi.com/go/context-cancellation-cause/
78•mweibel•3d ago•43 comments

Compiling Match Statements to Bytecode

https://xnacly.me/posts/2026/compiling-match-statements-to-bytecode/
5•ingve•2d ago•1 comments

Querying 3B Vectors

https://vickiboykis.com/2026/02/21/querying-3-billion-vectors/
65•surprisetalk•4d ago•9 comments

Tech employment now significantly worse than the 2008 or 2020 recessions

https://twitter.com/JosephPolitano/status/2029916364664611242
937•enraged_camel•20h ago•616 comments

My application programmer instincts failed when debugging assembler

https://landedstar.com/blog/posts/how-my-application-programmer-instincts-failed-when-debugging-a...
20•lifefeed•1d ago•14 comments

CT Scans of Health Wearables

https://www.lumafield.com/scan-of-the-month/health-wearables
226•radeeyate•23h ago•47 comments

Boy I was wrong about the Fediverse

https://matduggan.com/boy-i-was-wrong-about-the-fediverse/
59•wrxd•4h ago•30 comments

Launch HN: Palus Finance (YC W26): Better yields on idle cash for startups, SMBs

54•sam_palus•19h ago•81 comments

The Longing (1999)

https://www.cluetrain.com/book/longing.html
25•herbertl•3d ago•4 comments

Show HN: The Fastest Way to Ship TanStack Apps

https://tanstackstarterkit.com/
4•devarifhossain•3h ago•2 comments

Entomologists use a particle accelerator to image ants at scale

https://spectrum.ieee.org/3d-scanning-particle-accelerator-antscan
136•gmays•21h ago•24 comments