---
title: "A recipe for changing a column's type live"
publication: "Postgres Weekly"
issue: 514
published_at: "2023-07-12"
canonical_url: "https://postgresweekly.com/issues/514"
---

Plus an ongoing Postgres trademark dispute, Postgres.fm turns one, and generating TypeScript types from Postgres tables. |        

#​514 — July 12, 2023 

[Web Version](https://postgresweekly.com/issues/514)  

Together with [![Polyscale\](https://res.cloudinary.com/cpress/image/upload/c_fill,g_auto,e_trim,w_600,h_160/e_make_transparent/co_white,e_outline:12/rrcbnnamutiazyfczv81.png)](https://www.polyscale.ai/)   

Postgres Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60,q_auto/soxww30ub5cldg6t7gzl.jpg)](https://www.datanami.com/2023/07/10/microsoft-benchmarks-distributed-postgresql-dbs/)  

[Microsoft Benchmarks Distributed PostgreSQL-Like DBs](https://www.datanami.com/2023/07/10/microsoft-benchmarks-distributed-postgresql-dbs/) — Microsoft commissioned _GigaOM_ to benchmark Azure Cosmos DB for PostgreSQL (which uses Citus under the hood) versus other Postgres-derived alternatives from Cockroach and Yugabyte. The fact the results are being promoted tells you which product won already.. 😅 In a post by Marco Slot that goes into more detail, he explains [_why_ Cosmos DB is as fast as it is](https://devblogs.microsoft.com/cosmosdb/distributed-postgresql-benchmarks-using-hammerdb-by-gigaom/#why-azure-cosmos-db-for-postgresql-is-so-fast) and invites you to [run the benchmarks for yourself.](https://devblogs.microsoft.com/cosmosdb/distributed-postgresql-benchmarks-using-hammerdb-by-gigaom/#you-can-run-the-benchmarks-yourself) 

Alex Woodie (Datanami)   

[Subqueries and Performance](https://www.cybertec-postgresql.com/en/subqueries-and-performance-in-postgresql/) — Surround a `SELECT` with parentheses and use it to provide values to another query and you’ve got yourself [a subquery](https://www.postgresql.org/docs/current/functions-subquery.html). Laurenz walks through a few examples with the goal of helping us write subqueries that perform well. 

Laurenz Albe   [![\](https://copm.s3.amazonaws.com/abf26a4d.png)](https://www.polyscale.ai/) 

[Plug & Play Postgres Caching](https://www.polyscale.ai/) — Accelerate your database through serverless caching. Increase throughput and lower query latency using PolyScale’s intelligent database edge cache. Implement in minutes without configuration or writing code. 

PolyScale․ai sponsor   

[Let's Workshop an Unplanned Postgres Outage](https://www.enterprisedb.com/blog/lets-workshop-an-unplanned-postgres-outage) — This is certainly one of those things you want to think about before it happens! Shaun looks back at the story of one company’s Aurora migration which [had its problems](https://www.revenuecat.com/blog/engineering/postmortem-aurora-postgres-migration/) but broadly went well. 

Shaun Thomas   

[Changing a Column's Data Type in a Live Database](https://www.percona.com/blog/online-data-type-change-in-postgresql/) — `ALTER COLUMN ..` – stop! The exclusive lock that’s necessary to change a column’s data type can cause a production database to rapidly encounter some pain. What if we could make the change more gradually? 

Mateusz Henicz   

**IN BRIEF:** 

- [Postgres 16 beta 2 is now available](https://aws.amazon.com/about-aws/whats-new/2023/07/postgresql-16-beta-2-amazon-rds-database-preview-environment/) in Amazon RDS Database Preview Environment.
- ⚖️ The _PostgreSQL Community Association_ (which manages the Postgres trademark and Web site) has shared [an update on an ongoing Postgres trademark issue](https://www.postgresql.org/about/news/update-on-continued-trademark-actions-against-the-postgresql-community-2673/) with _Fundación PostgreSQL_, a Spanish non-profit that [has attempted](https://www.postgresql.org/about/news/trademark-actions-against-the-postgresql-community-2302/) to register Postgres-related trademarks separately.
- 🎧 The [Postgres FM podcast](https://postgres.fm/) has celebrated its first anniversary with [▶️ a special episode](https://postgres.fm/episodes/anniversary-mailbag) covering a mix of listener questions and suggestions sent in over the year.
- Serverless Postgres platform _Neon_ [compares HTTP vs WebSockets](https://neon.tech/blog/http-vs-websockets-for-postgres-queries-at-the-edge) for communicating with Postgres from edge functions. Neon has also introduced [same-region read replicas](https://neon.tech/blog/introducing-same-region-read-replicas-to-serverless-postgres) this week.   

[Migrate Postgres from Google Cloud Platform to Amazon RDS with Minimal Downtime](https://aws.amazon.com/blogs/database/migrate-postgresql-from-google-cloud-platform-to-amazon-rds-with-minimal-downtime/) — You never know when you might need to switch platforms, and AWS is always particularly keen to provide an easy route in. 

Aychin Gasimov (AWS)   

[Securing Your PostgreSQL Database](https://goteleport.com/blog/securing-postgres-postgresql/?utm_campaign=0712Cooperpress&utm_medium=partner&utm_source=postgres) 

Teleport | goteleport․com sponsor   

[PostGIS, ArcGIS Enterprise and the Tour De France Route](https://www.cybertec-postgresql.com/en/postgis-arcgis-enterprise-tour-de-france-route/) — How to analyze a stretch of the Tour de France with ArcGIS Enterprise and PostGIS. 
Florian Nadler   

[Quick Recipe for Compiling PostgREST on a M1/M2 Mac](https://rsdoiel.github.io/blog/2023/07/05/quick-recipe-compiling-PostgREST-M1.html) 
R. S. Doiel    

Code and Tools  

[Kanel: Generate TypeScript Types from Postgres](https://kristiandupont.github.io/kanel/) — It works by inspecting a live database and outputs code you can add to a TypeScript project and use with something like [Knex](https://knexjs.org/) (below) – [GitHub repo.](https://github.com/kristiandupont/kanel) 

Kristian Dupont   

[Knex.js 2.5: A Query Builder for Multiple Databases](https://github.com/knex/knex) — Knex is a popular ‘batteries included’ SQL query builder that supports Postgres, MySQL, SQL Server, SQLite3, and other SQL databases. 

knex   

[ZomboDB: Use Elasticsearch to Power Postgres Indexes](https://github.com/zombodb/zombodb) — Bring extra, powerful text-search and analytics features into Postgres by using Elasticsearch as an index type. 

ZomboDB LLC   

[GoodJob: Multithreaded, Postgres-Based, ActiveJob Backend for Ruby on Rails](https://github.com/bensheldon/good_job) — Complete support for async, queues, delays, priorities, timeouts, and retries with near-zero configuration. 

Ben Sheldon   

- [sqlc 1.19](https://github.com/kyleconroy/sqlc) – Generate type-safe Go code from SQL. As an aside, the sqlc developers have now [gone full time on the project.](https://sqlc.dev/posts/2023/07/06/working-on-sqlc-full-time/)
- [Crunchy Postgres for Kubernetes 5.4](https://www.crunchydata.com/blog/announcing-crunchy-postgres-for-kubernetes-5-4)
 ↳ Production-ready Kubernetes toolkit for Postgres.
- [Bytebase 2.4](https://github.com/bytebase/bytebase)
 ↳ Database devops and CI/CD tool for teams.
- [Prisma 5.0](https://github.com/prisma/prisma/releases/tag/5.0.0)
 ↳ Popular ORM for Node.js and TypeScript.
- [asyncpg 0.28](https://github.com/MagicStack/asyncpg)
 ↳ Fast Postgres client for Python/asyncio.
- [pg_graphql 1.2.3](https://github.com/supabase/pg_graphql)
 ↳ Add GraphQL support to Postgres.
- [pgxmock 2.9](https://github.com/pashagolub/pgxmock)
 ↳ Mock driver to test DB interactions in Go.    

**Got a new email?** You can [change your address here](https://postgresweekly.com/edit_subscription/*|UID|*). 

--- 

**Bored of us?** [Click here to stop getting Postgres Weekly](https://postgresweekly.com/leave/*|UID|*). 

--- 

**Got a link for us?** Reply and tell us. We can't include everything but we'll look at anything you send. _Thanks!_ 

--- 

Published by Cooper Press Ltd.
Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom 

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada. 

[Stop getting this newsletter](https://postgresweekly.com/leave/*|UID|*).
