What's New in Postgres 18 & 19 with Elizabeth Christensen
Transcript
By Elizabeth Garrett Christensen. From DjangoCon US 2026. Published October 26, 2026.
Watch the video Markdown version 4,132 words · auto-generated · en
Transcript
Automatically transcribed, so expect mistakes in names and technical terms. Filler words are removed.
Thank you so much. Happy to be here, as always, at DjangoCon. I am Elizabeth Christensen. I do a bunch of volunteer work for the Postgres Association, which is kind of a sister organization where we do very similar things to the Django organizations. I have a table out there with a bunch of Postgres stuff. If you want a hat or stickers, come see me after this. My day job is at Snowflake, and I do a bunch of work on our Snowflake Postgres thing. I have a very short time up here on stage, but I did feel like I had to say one thing, which is that I absolutely love this conference. And if you are an organizer, thank you so much for the time you put into this.
If you're a sponsor or you work for a sponsor, please thank them. And if you're a 10 attendee or a new attendee, I hope you appreciate what an amazing community this is to just be in and learn in. I always love coming to this. So thank you for having me. We're going to talk about a bunch of Postgres version stuff. If you're new to the world of Postgres versions and you haven't been keeping track, we do a fall release every year. Last fall we released Postgres 18. This fall we'll be releasing 19. That's why I did both for this talk, because I figured we'll do both. Hopefully you're running on some modern version of Postgres, like ideally a 17 or higher, and then Postgres 14 is kind of end of life.
Postgres 20 is what's being worked on right now, and you can test and do beta stuff with 19. Most of the stuff that I'm talking about today will make it in. But I did have to take some stuff out of my slides because they reverted some features last week. That happens; I'm sure that happens in Django too. Let me—yeah, we're gonna talk through really exciting features that developers probably want to know about. I'm gonna tell you a bunch of stuff that you get for free from just upgrading Postgres. We're going to talk about a couple of management tools, and then there's some bigger things happening in the world of Postgres I'm going to cover too. Probably the biggest feature that you'll want to know about for
Postgres 18, really, or 19, for Django work specifically is we did a big upgrade to the UUIDs. If you remember the random UUIDs that we had before, they were just kind of a randomized string, which is great, especially if you're putting primary keys or IDs in URLs or you're passing them to other systems. They're not great for a database because you can't index them. So there's a UUID standards committee. They kind of came up with a new way to do this so that databases could index UUIDs using this little timestamp thing, and that's the version seven that we have today. I talked to Paolo Paulo
last year, and he's already put this in Django, so thank a Django developer later today. And he has a whole talk tomorrow on UUIDs, and then he has a great blog on this topic too. But yeah, you can just put UUIDs straight into your models now and you're ready to go. And then if you are using it as a primary key in Postgres, it'll automatically be indexed. And then if you're maybe using it as a different field, you can tell Django to index that column, and you're good to go with just a standard B-tree index. I have chatted with a few people about data migration of UUIDs.
I probably wouldn't recommend that because they touch a lot of things in production. You could probably just start with new UUIDs, and over time your data would change. But maybe someone in this room is going to do UUID migration to a new version, and good luck. I'll see your talk next year. There's another cool feature that Postgres has coming out called virtual generated columns. We talked about this, I think, a little bit last year too. So Postgres for a long time has had virtual columns, which is basically where you're doing something with existing data in the database and you're making a column on the fly. Maybe you're calculating some kind of sales tax or you're concatenating a name, and for whatever reason you actually need that in a column.
And so this just lets you do that without storing the data in a separate column, which is great. Paolo did a great talk on this for the Microsoft Postgres conference called Poset. So if you want to get really deep into the generated columns, look at his YouTube talk on this. You can use the—this is what the SQL looks like. You're just basically saying, you know, generate it always as a virtual column. And then I think this talk is an homage to the great Paolo. Paolo also, I think, was involved in making sure that this would be supported in the Django ORM. So you just tell it the DB persist false, and then you're able to use this.
All right, so another feature: they're doing kind of an interesting little twist for updates. So when you update a field, it will give you both all of the old things and the new things. This has been a popular feature, even with the developers that I work with who do stuff on our systems, because we're always wanting to know new prices or new things that have happened. This is a cool feature. I don't think this is in Django yet. I saw some threads when I was kind of searching through your discussion thread. So I think there's some ongoing discussion about it. I don't know. I assume this at some point
will be coming down into the ORM. This is kind of a related feature. They're kind of always adding things like this. So you can do INSERT ... ON CONFLICT DO SELECT. The really common Postgres thing you would do is INSERT, and if there's a conflict, do nothing, right? So if there's a conflict, skip it and keep going. But this one will let you just return the same information back. So if you've got a conflict, and you know that row is already there, it'll just give you the row back. And so that's kind of a similar thing, just for making fewer calls to the database to find out what happened.
Yeah, so this is also kind of not supported yet in the Django ORM. I didn't see any discussions, but I assume it's probably related to the other INSERT discussions. Something to think about. We have to give Paolo something to do at his next sprint. There's some cool things that have happened in Postgres 18 with temporal stuff. If you're not familiar with temporal constraints, you're basically setting things up in the database so that you cannot ever have overlapping—either a scheduling system where you're doing calendars, or maybe shifts or some kind of hotel room thing. The way that Postgres did this before was just kind of bizarre
because of the way indexing works in Postgres, you had to kind of make a fake box with a fake span. You had to—It was so weird, and you had to add little tiny bits of space into it. But it worked, and you could actually use Postgres like this to do a temporal table. But it's weird, and the SQL is kind of odd and doesn't make a ton of sense. So they basically updated it to do this. The SQL is here. So you basically do a CREATE TABLE, and then you basically say just WITHOUT OVERLAPS. So what's interesting about this is that to make this feature possible, they made a new index type, which is called the B-tree GiST.
And if you know a little bit about Postgres indexing, B-trees are kind of a search tree, and GiST indexes are usually for spatial data, and they handle different data types. So you couldn't have a spatial search on a text field or a time field. And so they made this B-tree GiST index so that you could do this kind of searching. You're basically combining the B-tree and the GiST index into one idea to do this temporal stuff. But I think the way I kind of read it in the Django ORM stuff—and someone can correct me if I read it wrong—I think Django ORM just supports the old methods, since that's what people do.
And then I think there's some discussion about maybe updating it just so it maps to the other thing, but it's not a super high priority. The other thing works. It's just kind of weird. If you don't know a ton about Postgres constraints and you're building out your Postgres empire, adding constraints to your database can be really great, because they could do a lot of things that kind of protect you from your application code. If your bots are writing everything and you want to protect your actual data from the thing that's making the application code, you can add constraints to the database, which can be really nice. I don't know how many of you use window functions. Paolo and I are talking about this yesterday. Window functions in Postgres are kind of a way to look across large pieces of data.
So if you wanted to look at all of my orders from last week and compare those to all of the orders the week before, you can kind of create little windows and then look back through this. Typically used more in analytics, but this had a weird thing where you couldn't use NULLs because it would just mess all the math up. And so they added some stuff to let you just kind of roll over the ignored values, and you can just tell it when you build a window function to ignore NULLs. Okay, so that's the end of the features. I'll talk a little bit about things that we get just for free by upgrading Postgres. Postgres 18 got the async I/O feature.
Which basically uses some kind of newer Linux stuff that kind of helps I/O do more things at the same time and work asynchronously. Supposedly, Postgres says this is like two to three times faster reads. I've talked to some of the people that did a bunch of the benchmarking. I don't know a ton of people who've measured this in production with Postgres 18. So if you end up with three times faster reads, let me know. When I've done it, it's been a little bit lower than that, like more in, you know, 1.5 or something. But it's nice that they're always working on stuff and giving us stuff for free. Postgres had kind of a funky thing.
If you're doing indexing and you did multi-column indexing in Postgres, if you had—like, you can actually do a lot of columns, and multi-column indexes are very cool and a very good way to improve performance, especially when you have things that you're always calling together, like first name, last name, email address. So if you did all of the columns in order, fine. If you did just the first couple columns, fine. But Postgres wouldn't use your index if you called only the second column or only the second and third column. So they fixed that in Postgres 18, and basically if you have a multi-column index, you can call any of the columns. The feature is called index skip scanning. I don't know why they call it that, but
the guy that does the Postgres indexing work is brilliant. I don't understand any of his talks. I've been to five of them, and I just don't get it. So this is what I did get out of five hours of Postgres indexing on this slide. I don't know how many of you are rebuilding indexes all the time, but there are quite a few people who have to. They ingest data or they do data loads or things like that, and so they've been doing a lot of parallel index rebuilds and trying to make all that faster. So now you can do a parallel GIN index, and you can do faster GiST indexes if you're using those two. Okay, so I'm going to talk a little bit about some of these features for folks that are maybe like
Managing a Postgres database or kind of doing more with their Postgres than they were. So Postgres just got a huge upgrade. And this is probably, if there's a headline feature for Postgres 19, this is it. So it's a repacking thing. And if you've ever gone deep into how Postgres works, it has multiversion concurrency. So when you're updating rows of data in Postgres and you update a row or you delete a row or you change anything, it basically has a dead row in that table. And for folks that have really, really high update workloads or high delete workloads, you end up with lots and lots of dead rows that are just sitting there that are just like
Sitting there. And that's where a Postgres vacuum or the autovacuum will come in and sort of get rid of the old rows. The old rows have transaction IDs, and that gets also confusing. But it'll kind of clean that all up, and you'll have your space back. So if you end up with lots and lots of these dead rows, that's what's called table bloat. Most modern versions of Postgres ship with autovacuum, which is usually fine, but occasionally, for really high delete workloads, you will end up with all this crazy extra space, and it's kind of a mess. And so what Repack does is it basically lets you just repack your tables. There were several features that were popular before this.
Like there was something called PG Repack, that's a third-party extension. There's another one called PG Squeeze, if you've ever used that. And this sort of replaces all of those things. So what happens if you repack a table is it'll—You've got your bloated table that's got way too many rows in it, right? Maybe 25% of the rows are active and 75% of the table space is just bloated. It'll take a snapshot of that table, only the live rows. It'll copy that to another table, and then it'll use a logical replication kind of inside itself. And it'll replicate all of the writes, all of the reads, everything that's happening, to kind of keep that table up
Once it's copied over. And then once everything is ready, it just does a swap in a really short lock, and then you're kind of done. And what's cool is it'll do it concurrently, online. So it's like a no-downtime thing. And if you've ever had to do repack or squeeze, they're a little dicey, and they're run kind of outside your Postgres. And this is a cool tool, especially to help people that are dealing with bloat. Probably not a ton of you, but if it happens, you have a solution now that's built into Postgres. Kind of related to this, and we were talking just a second ago about vacuum, Postgres has parallelized queries now. So Postgres is kind of working on, you know, like everybody with all the parallel things.
So now they've added parallel vacuum workers. So if you're trying to keep up and trying to get a table vacuumed, you can do that in parallel now. And then Postgres 18 added OAuth 2.0. Postgres has never had a great story for single sign-on, so this is a huge step forward for us. This will support stuff like Okta, Keycloak, and Azure Entra stuff, which is like the new Active Directory. I just have been working on a bunch of the OAuth integration for Snowflake Postgres and testing all of that. So if you're interested in that, it's really cool. It basically lets you manage
Postgres users from an external thing, and then you can set up their roles and all of the things that they need in Postgres. You're reducing the role management by quite a bit. And so obviously, if you're on a managed service, your service provider has to support this. So I don't know where RDS is on the rollout of this. We're kind of just at the beginning of rolling this out on our platform. But I think this will be cool, and I think we'll hear a lot about it in the future. Postgres passwords for individual users are hashed. Like everything long ago, we used the MD5.
And that's phasing out for the SCRAM 256 stuff. If you have a really old Postgres database and people are using passwords that were made 10 years ago, you can look in your role table and find the MD5 ones. I don't think it's in Postgres 18 that they won't be able to log in. I think it's 19, but pretty soon people are actually not going to be able to log into Postgres, so they're trying to get everybody off of the MD5 passwords. Postgres, also in Postgres 19, just got query plan hints. I just had a long conversation with PG Analyze about this. They're outside, and they do some great Postgres work too.
Query plan hints are a feature that Oracle had, if you were in Oracle or did stuff, and I think SQL Server has it too. Postgres has never had this. Generally, the planner is really good at making query plans. Usually, if your query plan is broken, it's because you did something wrong and you wrote a bad query, or you need an index, or something's actually wrong. We were just talking that this is the most useless feature that no one will ever use because you just don't ever need it. So I can't come up with a reason why people would need this. I don't know. I think this may just be a feature that they added to shut the Oracle people up and just, we have it, move on. Like somebody just got tired of fighting, right?
And they're learning compromise, and they've been in therapy. This is what the query plan hints look like. You basically add a couple extensions, and then you can pull plans out of EXPLAIN now, if you're a big EXPLAIN person. You can pull those out. And then you basically just feed a plan back into Postgres. Yeah, so I'm going to talk about a couple of things that are happening in the bigger world of Postgres. One thing that just seems to be everywhere, and maybe that's just from my perspective, but it does seem like there's a lot of people connecting Postgres to either analytics databases or open table formats
and things in object storage. So Snowflake launched an open-source extension called PG Lake, where you can read and write into object storage with Postgres and talk to Apache Iceberg and Apache Parquet with Postgres. Databricks has a kind of similar idea. They bought a company that had an extension called PG Mooncake, and that kind of does some DocDB stuff inside Postgres. DuckDB launched an extension called PG DuckDB, which lets you run some DuckDB stuff in Postgres. And then we launched a couple extensions called PG Incremental, and that lets you kind of do incremental batch processing so that if you're moving stuff to Parquet
I think this is just kind of a sign of the times in Postgres right now, that people are ready to integrate Postgres with the wider world of object storage, and now we have a lot of options to do it. The other thing that's kind of been interesting in the last year is graph queries. I heard a lot about graph databases. That was a thing. It seemed really popular five years ago, but I was doing Postgres stuff, so I was kind of not following that. But there's a lot of interest now in doing graph things inside Postgres. And so Postgres 19 is kind of getting baby graph queries, just sort of the beginning of it. Graph queries
are probably not the most useful thing to a Django person if you're only doing application development. But if you're doing analytics and you need to write SQL or pull more complex data out, I think that's where you're gonna see it. If you've ever had to get through really deeply nested relationships, like an org chart at a company or parent-child relationships where everything's nested, you can write CTEs in Postgres to do this, but it's messy and it's not as easy. So they're kind of moving towards letting people use graphs. There's another extension in Postgres that does this too, called Apache AGE.
And it does kind of what the new graph feature does, but with a little bit more. And I've really only done a lot of testing on Apache AGE. And so it's kind of tied in a little bit to this world of object storage, where you've got lots and lots of data and you maybe have patient data that came from somewhere and all this different stuff, and you need to—there are complex relationships between all of the things, but you still want to get the data out with SQL. So that's kind of what graph queries are. But yeah, I'll just wrap this up and take a couple—Oh, I have no time. I will be outside if you want to come chat about Postgres
and come get a hat from me. Postgres 18 is out now. It'd be a great idea to upgrade every Postgres. I covered some high-level features, but every Postgres version comes with thousands and thousands of commits to make the query planner better, to make things faster. So I gave you the highlights, but there are good improvements in every version. If you want to beta test Postgres 19, and yeah, we're excited about all the stuff that Postgres can do. Thank you.