---
title: "Notion's Postgres sharding story"
publication: "Postgres Weekly"
issue: 426
published_at: "2021-10-13"
canonical_url: "https://postgresweekly.com/issues/426"
---

Plus the release of psycopg3, pgAdmin 4 v6.0, and more. |        

#​426 — October 13, 2021 

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

Postgres Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/o4hdgv48fcfqo5jkxglz.jpg)](https://cloud.google.com/blog/topics/developers-practitioners/postgresql-interface-adds-familiarity-and-portability-cloud-spanner)   

[Google Cloud Spanner Adds Postgres-Compatible Interface](https://cloud.google.com/blog/topics/developers-practitioners/postgresql-interface-adds-familiarity-and-portability-cloud-spanner) — [_Cloud Spanner_](https://cloud.google.com/spanner) is a Google cloud based relational database service boasting unlimited scalability, and now you can use it from even more places with a new Postgres interface. Notably, Kelsey Hightower [posited a year ago](https://twitter.com/kelseyhightower/status/1316541785858924545) that if Cloud Spanner were to have a Postgres compatible interface, it stood a chance of becoming _“the Gmail of ACID-compliant databases.”_ Well, now it has. 

Justin Makes (Google)   

[Herding Elephants: Lessons Learned from Sharding Postgres at Notion](https://www.notion.so/blog/sharding-postgres-at-notion) — Notion is a popular cloud-based knowledge management system and they lean heavily on Postgres. So heavily, in fact, they’ve needed to engage in a lengthy migration from a large Postgres monolith to a more horizontally-partitioned approach in order to scale. 

Notion   [![\](https://copm.s3.amazonaws.com/53a74d8e.jpg)](https://tsdb.co/timescale-community-day) 

[📣 Tune in to Timescale Community Day on October 28](https://tsdb.co/timescale-community-day) — Join live-streamed talks (full of demos!) with topics ranging from time-series data and PostgreSQL tips to general interest database topics. Connect with fellow community members, get expert tips, advice, and[more](https://tsdb.co/timescale-community-day). 

Timescale sponsor   

[How to Tune Sorting Operations with `work_mem`](https://aws.amazon.com/blogs/database/tune-sorting-operations-in-postgresql-with-work_mem/) — `work_mem` is a Postgres setting specifying how much memory to use for internal sort operations and hash tables before falling back to using temporary files. Given how common sorting is in database queries and how onerous temporary files can be, getting this setting right can yield some serious improvements. 

Naga Appani (AWS)   

[Multirange Types in Postgres 14](https://www.postgresonline.com/journal/index.php?/archives/401-Multirange-types-in-PostgreSQL-14.html#multirange) — One of the new features in Postgres 14 is _multirange_ types, essentially sets of non-overlapping ranges (e.g. 1-3 _and_ 6-8, as a singular concept). This post demonstrates their (very) basic use. 

Leo Hsu and Regina Obe   

[`SHOW TABLES` in Postgres: What's Wrong with It?](https://www.cybertec-postgresql.com/en/show-tables-in-postgresql-whats-wrong-with-it/) — Like many, I came to Postgres after being proficient with MySQL and getting my head around not using `SHOW TABLES` took a while. Of course, Postgres has its own even more efficient approach. 

Pavlo Golub   

[Installing Postgres on OpenBSD](https://fluca1978.github.io/2021/10/09/PostgreSQLOnOpenBSD.html) 
Luca Ferrari   

Tools & Code 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/jx59i3trmddij2cdfm0i.jpg)](http://okbob.blogspot.com/2021/10/pspg-540.html)   

[pspg (Postgres Pager) 5.4.0 Released](http://okbob.blogspot.com/2021/10/pspg-540.html) — pspg is a tool we’ve linked to numerous times over the years. It’s a ‘pager’ tool for working with table data from Postgres but continues to add new features, this time including customization of its color theme. 

Pavel Stěhule   

[Psycopg 3.0 Released: A Postgres Adapter for Python](https://www.psycopg.org/articles/2021/10/13/psycopg-30-released/) — Back in [issue 390](https://postgresweekly.com/issues/390) we featured an interview with Psycopg’s creator on his aims for Psycopg 3, the next generation of Python-Postgres adapters, which is now here in its final form. The [docs](https://www.psycopg.org/psycopg3/docs/#) will probably give you the best impression as to why to consider using it. 

Daniele Varrazzo   

[Build Internal Tools in Minutes with Retool, Where Visual Programming Meets the Power of Real Code](https://retool.com/?utm_source=sponsor&utm_medium=newsletter&utm_campaign=cooperpress) 

Retool sponsor   

[pgAdmin 4 v6.0 Released](https://www.postgresql.org/about/news/pgadmin-4-v60-released-2323/) — The popular Web-based interface for Postgres gets a big upgrade and, notably, switches to using React to power its front end. 

pgAdmin Team   

[pg_partman: Partition Management Extension](https://github.com/pgpartman/pg_partman) — Provides a way to automate the creation and maintenance of table partitions. 

Crunchy Data   

[Sequelize 6.7.0: Easy-to-Use Multi SQL Dialect ORM for Node.js](https://github.com/sequelize/sequelize) — Supports PG, MySQL, MariaDB, SQLite, & SQL Server and is fully promise-based. 

Sequelize    

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