Scaling Postgres · Creston Jamison
In this episode of Scaling Postgres, we discuss performance improvements in ParadeDB as a result of PlanetScale, an open source BM25 index from PGX Inc., pgbouncer and pgvector patching and direct I/O benefits during backup. To get the show notes as well as get notified of new episodes, visit: https://www.scalingpostgres.com/episodes/438-competition-is-good/ Want to learn more about Postgres performance? Join my FREE training called Postgres Performance Demystified here: https://www.scalingpostgres.com/courses/postgres-performance-demystified/
0:00Good news. This week there are no articles talking about Postgres 19 or the delays in its release date. Instead, the first article shows how competition can be good, particularly when it comes to performance, but I hope you, your friends, family and co workers continue to do well.
0:22Our first piece of content, PlanetScale released text search and we have a lot to say. Part 1 this is from paradedb.com so paradedb.com if you're not familiar, they have actually embedded tantiv to give Postgres BM25 ranked text search in Postgres and I did cover this article a number of weeks ago and this is what the PlanetScale article looks like. They released 10 which uses CTIDs to help track and do text searching. And you can see the really high performance difference between paradedB and 10, about tenfold, at least with the data set and the queries that they were using. And I particularly like on the graph here you can show balls, which basically shows how much faster TIN is compared to Parade db. And heaven help you if you're using Postgres Gen for doing text searching. But upon seeing this, and they say in this blog post, you know 10 is fast, at least 8 times faster than parade DB 0.25 in every planet scale benchmark. And the quote continues so fast that the only response which made sense was to shut up and put on our performance optimization hats.
1:41So kudos to them.
1:43This is why competition is good. And they tried to replicate the benchmarks using the same stack exchange, benchmark, data set, harness and machine types. And with the optimization they've done, they do see in certain cases, like looking at mixed queries and disjunction queries, maybe now it looks like they're three times faster than ten. Now are they truly three times faster? Again, you always have to take benchmarks with a grain of salt. But what I do appreciate is they saw how fast 10 was on planet scale, so they rolled up their sleeves and said all right, how can we make this fast?
2:19And at least according to these benchmarks, clearly they have. Now, one reason that they say that PlanetScale says tin is faster is it identifies rows by CTID values, whereas Tantive has to map values from docid to CTID values. So basically this map makes things slower compared to just using CTID values as the direct document identifiers. But they question that and some of the changes they made, they're still using the Tantive engine which uses that.
2:53So they're still mapping the tantive doc IDs to CTIDs and they looked at another hacker news and it appears that ParayDB is twice as fast or more across various different metrics, although not as quite as much with two terms in a top K search.
3:12So in terms of what they did, they also saw a few cases where it kind of depends on how things were configured. So there are cases where you could configure 10 to be faster than Parade DB, but it's based upon the dense ratio and then once stop words are enabled that made paradedb faster.
3:33So how you set up the benchmarks does matter, but in terms of what paradedb did, they started writing a denser structure with better data locality for finding documents. Now this makes the index a bit larger, but it makes it faster. They're also using a blockmax algorithm with a higher throughput. And third, a few other small optimizations related to lazy reading of other pieces of data and more detail is up above, but they said most of these changes were happening in the TANT V library, apparently not in their integration code. So these performance improvements are in their 0.26 release candidate two, so those results should be reproducible from that and it will be in the Next stable release 0.26 targeted for next week. So if you want to learn more, definitely encourage you to check this out.
4:26Next piece of content related to the previous ones is PGX BM25 1.0 B VM25 ranked full text search as a native PostgreSQL index.
4:37So PGX Incorporated has released version 1.0 of a BM25 index. So it's essentially what TIN is. And the Parade DB solution is and it says the whole index lives in the index relations own pages. So it gets wall log, crash recovery, physical replication, et cetera. So there's no external search engine and no separate runtime to operate there. Now what does the performance look like? Don't know. But this is an open source alternative so you can check this out if you're interested as well.
5:10Next piece of content, nobody patches the pooler. This is from thebuild.com and it is easy to forget about. Hey, you're upgrading Postgres. Oh, when was the last time we upgraded PgBouncer? Who knows?
5:24And that is a particular problem now because of the vulnerabilities that that are now in the public domain for versions less than 1.26 because out of the most recent 3 CVEs 2 of them can be triggered by anyone who can open a PC connection to the listener. So if you have PgBouncer running on the public Internet. You need to patch this ASAP.
5:48And he goes ahead and discusses the different CVEs, but basically patch it as soon as you can.
5:55Next post Also related to security CVEs is the vector that lied about its dimensions. This is also from thebill.com and there's a PGvector release 0.8.7 which fixes a CVE that can create an IVF flat index that writes out of bounds on the back end, which can lead to arbitrary code execution. Now what's interesting, what he listed here is that this is the third time this year, he says.
6:22So it's the third time that a memory safety CVE has appeared in PGvector's index build code this year. And he mentions the other CVEs. So again, if you're using PGvector in your database, definitely go ahead and upgrade that package. Next piece of content what is DirectIO and why does Clickhouse managed Postgres use it for backups? This is from Clickhouse.com and DirectIO basically is a flag that tells the kernel to skip the cache for particular reads.