r/programming • • 8d ago

PostgreSQL 19 Released!

https://www.postgresql.org/about/news/postgresql-19-released-3449/
840 Upvotes

33 comments sorted by

View all comments

Show parent comment

147

u/Solonotix 8d ago

Probably the best thing about using SQL these days is that you can just kind of expect that the only things added version-over-version are quality of life things.

There are some exceptions, of course, like yesterday I had to contrive a solution in SQL Server 2019 that didn't depend on regex when it would have been immensely helpful. Had to re-educate my brain on using CHARINDEX and SUBSTRING to get the same result. But for the most part, I just know that the syntax will work, and I can do what I want with little concern.

24

u/Perfekt_Nerd 7d ago

Yeah, regex was just introduced in SQL Server 2025. Still vastly prefer it over Postgres because of clustered indexes, it's just a shame that running it on Linux has so many limitations.

7

u/davvblack 7d ago

do clustered indexes even matter on nvme storage?

11

u/TheBanger 7d ago

It's not just a matter of randomly placed seeks, for small tuples a clustered index also means you're more likely to have multiple matching tuples per page

10

u/Perfekt_Nerd 7d ago

Absolutely. There is a massive difference between a seek and a scan on any moderately complex query

5

u/Solonotix 7d ago

Being able to design a clustered index is a means of ordering the data as it is stored within a logical volume. An index seek is akin to accessing an array by its index. An index scan is akin to iterating over the entire array until you find the relevant items. The clustered index is what determines the order. Additionally, SQL Server will take sargable predicates and attempt a binary search to get in the rough area of the table where the relevant rows are.

So, yes, the clustered index is very beneficial. Most other SQL implementations get by using nonclustered indexes for this purpose, and it works well enough.