/PostgreSQL

Shrinking A Postgres Table

- John Nunemaker tl;dr: John discovered his Postgres database was using 87% disk space, mainly due to unprocessed downloads in a podcast hosting app. Rather than batch-deleting millions of old records, they used a table-swapping technique to create a new table with only recent data, freeing up significant space quickly and efficiently.

featured in #570


Don't Do This

tl;dr: Things not to do in PostgreSQL, broken down into the following sections: (1) Database Encoding. (2) Tool usage. (3) SQL constructs. (4) Date/Time storage. (5) Text storage. (6) Other data types. (7) Authentication. 

featured in #568


What I Wish Someone Told Me About Postgres

- Hazel Bachrach tl;dr: “I want to try to catalog the bits that I wish someone had just told me before working with a Postgres database. Hopefully, this makes things easier for the next person going on a journey similar to mine. Note that many of these things may also apply to other SQL database management systems (DBMSs) or other databases more generally, but I’m not as familiar with others so I’m not sure what does and does not apply.”

featured in #566


Building A Modern PostgreSQL Service

- Nikolas Burk tl;dr: Prisma launched a hosted database offering, architected from the ground up for high performance and flexibility. Running on bare metal and modern Unikernel technology allows Prisma to offer a database that starts free and scales as demand grows. Prisma Postgres comes with a scalable managed connection pool, global cache, and streaming real-time database events built-in — perfect for developers building for a global audience.

featured in #564


Optimizing Postgres Table Layout For Maximum Efficiency

- Renato Massaro tl;dr: “When modeling a Postgres database, you probably don’t give much thought to the order of columns in your tables. After all, it seems like the kind of thing that wouldn’t affect storage or performance. But what if I told you that simply reordering your columns could reduce the size of your tables and indexes by 20%? This isn’t some obscure database trick — it’s a direct result of how Postgres aligns data on disk.”

featured in #557


Postgres As A Search Engine

- Eric Zakariasson tl;dr: “While semantic search is trendy, good old lexical search is still the backbone. Semantic techniques can improve results, but they work best when added to a solid text-based search foundation. In this post, we’ll explore how to use Postgres to create a robust search engine.”

featured in #544


How To Get Or Create In PostgreSQL

- Haki Benita tl;dr: "Get or create" is a very common operation for syncing data in the database, but implementing it correctly may be trickier than you may expect. If you ever had to implement it in a real system with real-life load, you may have overlooked potential race conditions, concurrency issues and even bloat.

featured in #540


How Postgres Stores Data On Disk

- Drew Silcock tl;dr: “Databases aren’t that complicated. I mean, they kind of are but if you dig inside the database engine a bit, you realise that it’s really just some immensely powerful and clever abstractions and that, like most software, most of the actual complexity in these pieces of software comes from the edge cases, often around concurrency. I’d like crack open the hard shell of database engines with some friendly introductions to those who are familiar with relational databases but don’t know their inner machinations.”

featured in #539


Implementing Stripe-like Idempotency Keys In Postgres

- Brandur Leach tl;dr: “In APIs idempotency is a powerful concept. An idempotent endpoint is one that can be called any number of times while guaranteeing that the side effects will occur only once. In a messy world where clients and servers that may occasionally crash or have their connections drop partway through a request, it’s a huge help in making systems more robust to failure. Clients that are uncertain whether a request succeeded or failed can simply keep retrying it until they get a definitive response.”

featured in #535


Postgres Is All You Need, Even For Vectors

- Eric Zakariasson tl;dr: “When working with LLMs, you usually want to store embeddings, a vector space representation of some text value. During the last few years, we’ve seen a lot of new databases pop up, making it easier to generate, store, and query embeddings: Pinecone, Weaviate, Chroma, Qdrant. The list goes on. But having a separate database where I store a different type of data has always seemed off to me. Do I really need it?”

featured in #524