News for hackers. Stuff that matters.
Re:Run Ordinary Rails Apps Globally (2021) by jitl on Wednesday January 26, 2022 @10:40AM (#30086791)
> full PostgreSQL compatibility

By "full", you mean "some"? From [the documentation] on Spanner's PostgreSQL Interface:

> This means that applications written against the PostgreSQL interface can be readily ported to another PostgreSQL environment, obviously without the non-functional benefits, like scalability and availability, that are unique to Cloud Spanner. However, 100% compatibility with PostgreSQL is not the goal.

> The PostgreSQL interface provides a rich subset of the open-source PostgreSQL SQL dialect, including common query syntax, functions, and operators

It seems like existing simple Postgres applications could switch to Spanner, but it does require running a sidecar if your app wants to continue speaking the Postgres protocol on the wire, instead of integrating a Spanner API client.

When it comes to [datatypes], Spanner's PostgreSQL interface is very limited. According to the docs, only these types are supported:

> bool, bytea (byte array), float8 (64-bit IEEE-754 float), int8 (signed 64-bit int), numeric/decimal, timestampz, text.

Notably missing for [my use-case] are UUID, JSON/JSONB, array types like UUID array, and custom enum types. The indexing support is also quite sparse. Full Postgres compatibility, this is not :(

[the documentation]: https://cloud.google.com/spanner/docs/postgresql-interface

[datatypes]: https://cloud.google.com/spanner/docs/reference/postgresql/d...

[my use-case]: https://www.notion.so

Re:Run Ordinary Rails Apps Globally (2021) by mhoad on Wednesday January 26, 2022 @11:27AM (#30087539)
I didn’t know Notion was a Rails product, that’s pretty cool!

Just for disclosure, I used to do a bunch of Rails but I haven’t touched it since the start of covid so it’s applicability to some of what I mentioned was not something I’ve actively built and so I haven’t figured out where all the rough parts are yet because it’s just not a use case of mine these days.

But that second link I mentioned sounds maybe more promising? I initially skimmed it and thought it was there to handle the PostgreSQL to Spanner integration but looking at it a second time it sounds more like native Spanner integration but keeping the otherwise Rails native ActiveRecord experience.

If you’re building against a bunch of PostgreSQL specific functionality then maybe you’re still stuck with the same problem but I don’t think there is a generally speaking more capable publicly available SQL database out there than Spanner than I am aware of is there?

But as a side note if you’re Notion in this situation and not a random small team of a few people I don’t imagine you would have much of a problem reaching out to the GCP team to explain your current set up / requirements, they would be more than happy to give you a custom roadmap to migrate to Spanner, they have entire teams dedicated to exactly those kinds of projects.

Re:Run Ordinary Rails Apps Globally (2021) by jitl on Wednesday January 26, 2022 @12:47PM (#30088854)
Notion isn't a Rails product - but we do use Postgres as our primary datastore.