logo
episode-header-image
Sep 2024
27m 39s

Postgres is combining IO in version 17

Hussein Nasser
About this episode


Learn more about database and OS internals, check out my courses 

Fundamentals of database engineering https://databases.win 

Fundamentals of operating systems https://oscourse.win



This new PostgreSQL 17 feature is game changer.


You see, postgres like most databases work with fixed size pages. Pretty much everything is in this format, indexes, table data, etc. Those pages are 8K in size, each page will have the rows, or index tuples and a fixed header. The pages are just bytes in files and they are read and cached in the buffer pool.


To read page 0, for example, you would call read on offset 0 for 8192 bytes, To read page 1 that is another read system call from offset 8193 for 8192, page 7 is offset 57,345 for 8192 and so on. 


If table is 100 pages stored a file, to do a full table scan, we would be making 100 system calls, each system call had an overhead (I talk about all of that in my OS course). 


The enhancement in Postgres 17 is to combine I/Os you can specify how much IO to combine, so technically while possible you can scan that entire table in one system call doesn’t mean its always a good idea of course and Ill talk about that. 


This also seems to included a vectorized I/O, with preadv system call which takes an array of offsets and lengths for random reads. 


The challenge will become how to not read too much, say I’m doing a seq scan to find something, I read page 0 and found it and quit I don’t need to read any more pages. With this feature I might read 10 pages in one I/O and pull all its content, put in shared buffers only to find my result in the first page (essentially wasting disk bandwidth, memory etc) 


It is going to be interesting to balance this out. 


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
Aug 14
Why the Next AI Breakthrough Might Come from You
Welcome to Chat GPT, the only podcast where artificial intelligence takes the mic to explore the fascinating, fast-changing world of AI itself. From ethical dilemmas to mind-bending thought experiments, every episode is written and narrated by AI to help you decode the technology ... Show More
7m 50s
May 24
How GPT-4 Sees the World And What It Misses
Welcome to Chat GPT, the only podcast where artificial intelligence takes the mic to explore the fascinating, fast-changing world of AI itself. From ethical dilemmas to mind-bending thought experiments, every episode is written and narrated by AI to help you decode the technology ... Show More
7m 36s
Jun 12
The Everyday Ways AI Is Already Making Decisions For You
Welcome to Chat GPT, the only podcast where artificial intelligence takes the mic to explore the fascinating, fast-changing world of AI itself. From ethical dilemmas to mind-bending thought experiments, every episode is written and narrated by AI to help you decode the technology ... Show More
7m 17s
May 11
From Shakespeare to Search Engines Why AI Loves Text
Welcome to Chat GPT, the only podcast where artificial intelligence takes the mic to explore the fascinating, fast-changing world of AI itself. From ethical dilemmas to mind-bending thought experiments, every episode is written and narrated by AI to help you decode the technology ... Show More
7m 40s
Jul 16
What Happens When AI Gets It Wrong
Welcome to Chat GPT, the only podcast where artificial intelligence takes the mic to explore the fascinating, fast-changing world of AI itself. From ethical dilemmas to mind-bending thought experiments, every episode is written and narrated by AI to help you decode the technology ... Show More
6m 28s
Oct 2019
Brian Rose Discusses London Real's Upcoming Documentary ReConnect Featuring Jordan Peterson
ReConnect WORLD PREMIERE Tickets: https://londonreal.link/reconnect Real Deal is your chance to join me LIVE to discuss the big issues. We go deep on anything and everything - from spirituality to parenting to movies - and I want you to send me any questions or thoughts you have ... Show More
2m 28s
May 9
From Curiosity to Code How Humans Teach Machines
Welcome to Chat GPT, the only podcast where artificial intelligence takes the mic to explore the fascinating, fast-changing world of AI itself. From ethical dilemmas to mind-bending thought experiments, every episode is written and narrated by AI to help you decode the technology ... Show More
9m 37s
Nov 2024
OpenAI Launches "ChatGPT Search" Competing with Google / Perplexity
In this episode, we explore OpenAI's new SearchGPT model and its potential to challenge Google and Perplexity in the search engine landscape. We discuss the features and capabilities that set SearchGPT apart as OpenAI's latest innovation in AI-powered search. Get on the AI Box Wa ... Show More
9m 29s
Jan 2025
Just How Fast is AI Evolving?
Between reasoning models and agents, things feel like they're heating up. But just how fast are things really going? A reading and discussion inspired by https://www.oneusefulthing.org/p/prophecies-of-the-flood Brought to you by: KPMG – Go to ⁠⁠⁠⁠⁠www.kpmg.us/ai⁠⁠⁠⁠⁠ to learn ... Show More
14m 47s