logo
episode-header-image
Mar 2023
49m 11s

All Postgres Locks Explained | A Deep Di...

Hussein Nasser
About this episode

Get my database engineering course https://database.husseinnasser.com


In this video I do a deep dive in all locks obtained by postgres, I learned a lot while making this video and hope you enjoy it. 


0:00 Intro 

2:30 What are Locks? 

5:30 Overview of Postgres Locks

9:10 Table-Level Locks

11:40 ACCESS EXCLUSIVE

17:40 ACCESS SHARE

19:00 ROW SHARE
20:15 ROW EXCLUSIVE

21:15 SHARE UPDATE EXCLUSIVE

23:30 SHARE

24:50 SHARE ROW EXCLUSIVE

25:18 EXCLUSIVE

25:30 Table Lock Conflict Matrix

28:30 Row-Level Locks

30:00 FOR UPDATE

33:00 FOR NO KEY UPDATE

34:00 FOR SHARE

34:40 FOR KEY SHARE
35:10 Row Lock Conflict Matrix

39:25 Page-Level Locks

42:00 Deadlocks

46:00 Advistory Locks

47:20 Summary



https://www.postgresql.org/docs/current/explicit-locking.html


Up next
Jun 13
kTLS - Kernel level TLS
Fundamentals of Operating Systems Course https://oscourse.winktls is brilliant.TLS encryption/decryption often happens in userland. While TCP lives in the kernel. With ktls, userland can hand the keys to the kernel and the kernel does crypto. When calling write, the kernel encryp ... Show More
22m 55s
May 9
The beauty of the CPU
If you are bored of contemporary topics of AI and need a breather, I invite you to join me to explore a mundane, fundamental and earthy topic.The CPU.A reading of my substack article https://hnasr.substack.com/p/the-beauty-of-the-cpu 
9m 38s
Apr 2025
Sequential Scans in Postgres just got faster
This new PostgreSQL 17 feature is game changer. They know can combine IOs when performing sequential scan. Grab my database coursehttps://courses.husseinnasser.com 
27m 36s
Recommended Episodes
Feb 2022
#507: February 2022 Update Show 2
Some interesting updates across all kinds of topics this week! Remember you can record feedback at https://d1ox81nm0qxip8.cloudfront.net/index.html Chapters: 00:21 Analytics 02:58 Application Integration 03:10 Compute 04:30 Customer Engagement 05:27 Database 07:44 Developer Tools ... Show More
22m 39s
May 2023
The ORMazing show
Nick & KBall sit down with the brilliant Stephen Haberman to discuss all things ORMs! 💻🔍 From the advantages and disadvantages of ORMs in general, to delving into the intricacies of his innovative project Joist, which brings a fresh, idiomatic, ActiveRecord-esque approach to Ty ... Show More
1h 12m
May 2022
#526: May 2022 Update Show 3
Lots of interesting things to hear about this week! Chapters: 00:28 Analytics 02:44 Application Integration 03:52 Business Applications 04:07 Compute 10:26 Developer Tools 11:14 Frond-end Web & Mobile 11:39 Games 12:33 Internet of Things (IoT) 13:54 Machine Learning 17:10 Managem ... Show More
27m 15s
Sep 2021
We could've had THIS!?
0:00 stage fright, it happens  0:03 RTX 3080 Ti 20GB was real  1:08 Apple Event, iPhone 14 renders  2:24 El Salvador Bitcoin shenanigans  3:25 Build Redux  3:54 QUICK BITS  4:00 ProtonMail controversy  4:40 Australian comments liability ruling  5:10 TikTok closing in on YouTube  ... Show More
7m 18s
May 2023
Blockchain Scalability w/ Cartesi
Omran is a tech-savvy with a background in software architecture for more than 15 years, having worked in big companies such as Google and Intel. Max, on the other hand, even without a tech background, has always been curious about innovation and technology, using business models ... Show More
1h 3m
Apr 2024
In the Vault: Placing Multiple Bets on a ‘Mosaic of Solutions’ With Former Global Payments CEO Jeff Sloan
In a new episode of In the Vault, a16z General Partner Angela Strange talks with Jeff Sloan, former CEO of Global Payments, about how he was early to spot significant industry trends, how to make bets that move an organization, and the sea change that AI represents for the financ ... Show More
32m 14s
Nov 2023
Ameen Soleimani of Privacy Pools | Unpacking Privacy Pools – Motivations, Mechanics, and Tradeoffs
The Hashing it Out team speaks with Ameen Soleimani, co-author of the Privacy Pools paper - Blockchain Privacy and Regulatory Compliance: Towards a Practical Equilibrium. Ameen, along with Vitalik Buterin (Ethereum Foundation), Jacob Illum (Chainalysis), Matthias Nadler (Universi ... Show More
1h 16m
Dec 2019
How to Get Rich: Every Episode
This giant episode collects every interview I’ve done on “How to Get Rich.” It includes 10 minutes of unreleased material—at the end—on “Finding Time to Invest in Yourself.” Transcript: http://nav.al/rich Seek Wealth, Not Money or Status 1:30 Make Abundance for the World 6:40 Fre ... Show More
3h 35m
Jun 2019
How to Get Rich: Every Episode
This giant episode collects every interview I’ve done on “How to Get Rich.” It includes 10 minutes of unreleased material—at the end—on “Finding Time to Invest in Yourself.” Transcript: http://nav.al/rich Seek Wealth, Not Money or Status 1:30 Make Abundance for the World 6:40 Fre ... Show More
3h 35m
Feb 2023
#572: February 2023 Update Show 2
Continuing the new shorter format! Shorter, easier to listen to - but still covering all the updates that have been happening! Plus a new host joins the team! Chapters: 00:27 Welcoming new Co-Host 16:02 Analytics 17:29 Application Integration 18:38 Business Applications 18:50 Com ... Show More
37m 50s