48 karma · joined February 26, 2014
https://www.postgresql.org/docs/current/explicit-locking.htm...
So the article is correct that SELECT FOR UPDATE will ensure that another concurrent SELECT FOR UPDATE transaction never acquire the same row (it will block), though nothing prevents other non-blocking selects to query this row concurrently.
You can think of it as usual locks - only the threads that explicitly use the same lock have the mutual exclusion guarantees. If there’s another thread that does not acquire the lock and tries to access the critical section - it will be able to do so.
I like articles like this since they hopefully help me to fine tune my intuition.
The great examples of this are 'A from-scratch tour of Bitcoin in Python' https://karpathy.github.io/2021/06/21/blockchain/ and 'Let's build GPT: from scratch, in code, spelled out' https://youtu.be/kCc8FmEb1nY from Andrej Karpathy
I wonder if anybody tried to collect all such projects together and built his own 'Internet in just 100 lines of code'
I would love to be still able to discover low-ranging websites like this. I remember somebody shared some alternative search engine?