What's the difference between Google Cloud Spanner and Cloud SQL?
Asked Answered
A

4

43

I am novice in GCP stack so I am so confused about several listed technologies for storing data:

https://cloud.google.com/products/databases

Specifically, I'm interested in the differences between Cloud Spanner and Cloud SQL.

From my current view I don't see any significant difference between Cloud SQL(with postgres under the hood) and Cloud Spanner. I found that it has a bit different syntax but it doesn't answer when I should prefer this technology to spring cloud sql.

Could you please explain it ?

P.S.

I consider spring cloud SQL as a traditional database with automatic replication and horizontal scalability managed by google.

Arlie answered 26/2, 2020 at 11:16 Comment(0)
R
57

There is not a big difference between them in terms on what they do (storing data in tables). The difference is how they handle the data in a small and big scale

Cloud Spanner is used when you need to handle massive amounts of data with an elevated level of consistency and with a big amount of data handling (+100,000 reads/write per second). Spanner gives much better scalability and better SLOs.

On the other hand, Spanner is also much more expensive than Cloud SQL.

If you just want to store some data of your customer in a cheap way but still don't want to face server configuration Cloud SQL is the right choice.

If you are planning to create a big product or if you want to be ready for a huge increase in users for your application (viral games/applications) Spanner is the right product.

You can find detailed information about Cloud Spanner in this official paper

Rosalindarosalinde answered 26/2, 2020 at 11:44 Comment(4)
could you explain what is SLO ?Arlie
SLO (Service-Level Objective) it's basically the reliability of a product. The SLA (Service Level Agreement) is the compromise of the minimun service that you can expect from a product. For Spanner is >= 99.999% montlhy. For Cloud SQL is > 99.95% MontlhyRosalindarosalinde
Could you explain phrase "handle the data in a small and big scale" ?Arlie
What I mean is that Cloud SQL is intended for a much smaller amount of data and transactions than Spanner. The key when you are choosing between Spanner and Cloud SQL is Scalability, Reliability, and Price. If you go deeper into the small details you will find many difference i.e. Spanner requires 1 processing node for each 2TB of data. Here you can find a detailed paper describing the spanner in more deepRosalindarosalinde
C
35

The main difference between Cloud Spanner and Cloud SQL is the horizontal scalability + global availability of data over 10TB.

Spanner isn’t for generic SQL needs, Spanner is best used for massive-scale opportunities. 1000s of writes per second, globally. 10,000s - 100,000s of reads per second, globally.

Above volume is extremely difficult to achieve with NORMAL SQL / MySQL without doing complex sharding of the database. Spanner deals with all this AND allows ACID updates (which is basically impossible with sharded databases). They accomplish this with super-accurate clocks to manage conflicts.

In short, Spanner is not for CRM databases, it is more for supermassive global data within an organisation. And since Spanner is a bit expensive (compared to cloud SQL), the project should be large enough to justify the additional cost of Spanner.

You can also follow this discussion on Reddit (a good one!): https://www.reddit.com/r/googlecloud/comments/93bxf6/cloud_spanner_vs_cloud_sql/e3cof2r/

Caricaria answered 26/2, 2020 at 11:47 Comment(4)
Cloud sql supports horizontal scaling too: cloud.google.com/community/tutorials/…Arlie
that's why I have added + globally available!Caricaria
What do you mean "globally available"?Arlie
"globally available" => one can avail the same database in different region if GCP services with minimum latency which can support data over 10TBCaricaria
Q
5

Previous answers are correct, the main advantages of Spanner are scalability and availability. While you can scale with Cloud SQL, there is an upper bound to write throughput unless you shard -- which, depending on your use case, can be a major challenge. Dealing with sharded SQL was the big problem that Spanner solved within Google.

Quintic answered 26/2, 2020 at 21:51 Comment(0)
D
2

I would add to the previous answers that Cloud SQL provides managed instances of MySQL or PostgreSQL or SQL Server, with the corresponding support for SQL. If you're migrating from a MySQL database in a different location, not having to change your queries can be a huge plus.

Spanner has its own SQL dialect, although recently support for a subset of the PostgreSQL dialect was added.

Danicadanice answered 22/10, 2021 at 17:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.