---
title: "Listening to Postgres changes in real time"
publication: "Postgres Weekly"
issue: 404
published_at: "2021-05-05"
canonical_url: "https://postgresweekly.com/issues/404"
---

Plus multi-column type casting for JSONB, an interview with Dave Page, and a universal CLI for databases. |        

#​404 — May 5, 2021 

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

Postgres Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/psuhygcnaxoh6wlhdjje.jpg)](https://www.tangramvision.com/blog/creating-postgresql-test-data-with-sql-pl-pgsql-and-python)   

[Creating Test Data with SQL, PL/pgSQL, and Python](https://www.tangramvision.com/blog/creating-postgresql-test-data-with-sql-pl-pgsql-and-python) — Greg posits that creating test data on the fly can encourage you to think more deeply about your data model (a good thing) and more easily work at the scale of your choice. An interesting aspect to this tutorial is you can _follow along_ using Docker (and I did). 

Greg Schafer   [![\](https://copm.s3.amazonaws.com/da207259.png)](https://fauna.com/postgres?utm_source=PostgresWeekly&utm_medium=Newsletter&utm_campaign=CooperPress_Newsletters_2021) 

[An Operations-Free, Scalable & Flexible Postgres Alternative](https://fauna.com/postgres?utm_source=PostgresWeekly&utm_medium=Newsletter&utm_campaign=CooperPress_Newsletters_2021) — Fauna combines the operational integrity and relational modeling of Postgres with an interface and architecture that fits better with modern app development in the cloud. The goodness of Postgres without its operational bottlenecks - [Learn more about Fauna](https://fauna.com/postgres?utm_source=PostgresWeekly&utm_medium=Newsletter&utm_campaign=CooperPress_Newsletters_2021). 

Fauna sponsor   

[Supabase: Listen to Database Changes in Real Time via WebSockets](https://github.com/supabase/realtime) — We first mentioned this project over a year ago and it’s continuing to get updates ([here’s their latest news](https://supabase.io/blog/2021/05/03/supabase-beta-april-2021)). They’ve also released a system to [continuously sync a Stripe account to a Postgres database.](https://github.com/supabase/stripe-sync-engine) 

Supabase   

[An Interview with Dave Page](https://postgresql.life/post/dave_page/) — The latest in the _PostgreSQL Person of the Week_ series of interviews is a substantial one with a prominent member of the community (he’s on the core team and board of directors and has been working on Postgres for over 20 years). 

Andreas Scherbaum   

[JSONB Multi-Column Type Casting](https://momjian.us/main/blogs/pgblog/2021.html#May_3_2021) — I’ve been doing a lot of work with JSONB columns lately and this neat way to type cast multiple values at once totally passed me by. Useful. 

Bruce Momjian   

[TLS: Demystifying Communication Encryption in Postgres](https://www.cybertec-postgresql.com/en/tls-demystifying-communication-encryption-in-postgresql/) — TLS (Transport Layer Security) is a widely used technology to encrypt client/server connections, including with Postgres. Here’s a high level look at the main concepts involved. 

Julian Markwort   

[Finding the Root Cause of Slow Postgres Queries Using EXPLAIN](https://pganalyze.com/ebooks/explain-slow-postgres-queries?utm_source=PostgresWeeklySecondary05052021) — An in-depth guide on how to use Postgres EXPLAIN to find and improve problematic query plans and how to use auto_explain. 

pganalyze sponsor   

[Implementing Incremental View Maintenance for Postgres](https://yugonagata-pgsql.blogspot.com/2021/04/implementing-incremental-view_61.html) 
Yugo Nagata   

[Citus Tips for Postgres: How to Alter Distribution Key, Shard Count, and More](https://techcommunity.microsoft.com/t5/azure-database-for-postgresql/citus-tips-for-postgres-how-to-alter-distribution-key-shard/ba-p/2311470) 
Halil Ozan Akgul   

🔧**Tools and Code**   

[usql 0.9: A Universal CLI for Databases](https://github.com/xo/usql) — A CLI tool (written in Go) for working with Postgres, SQL Server, MySQL, SQLite3, Oracle Database, CockroachDB, and [many more.](https://github.com/xo/usql#database-support) A database Swiss Army knife, if you will. [v0.9.0](https://github.com/xo/usql/releases/tag/v0.9.0) adds command autocomplete, a `\copy` command to move data between databases, and more. 

Kenneth Shaw   

[Datanymizer: A Database Anonymizer with Flexible Rules](https://evrone.com/datanymizer) — Written in Rust, this tool offers in-flight template-driven data anonymization for Postgres (only, for now - MySQL support is on the way). [GitHub repo](https://github.com/datanymizer/datanymizer). 

Evrone   

[sqlc 1.8: Generate Type Safe Go(lang) from SQL](https://github.com/kyleconroy/sqlc) — You write SQL queries, run `sqlc` to generate code and interfaces for those queries, then write Go code that calls the aforementioned code. [1.8.0](https://github.com/kyleconroy/sqlc/releases/tag/v1.8.0) adds support for Postgres 12 and 13 features by upgrading an underlying dependency. 

Kyle Conroy    

**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! 

--- 

**Want more?** You might like [DB Weekly](https://dbweekly.com/?utm_source=pg&utm_medium=email&utm_campaign=footer-promo), our more general database newsletter covering data storage trends, new database types, and more. 

--- 

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|*)
