From the course: Google Cloud Data and Storage Foundations

Relational databases: When to use Cloud SQL or Cloud Spanner - Google Cloud Tutorial

From the course: Google Cloud Data and Storage Foundations

Start my 1-month free trial

Relational databases: When to use Cloud SQL or Cloud Spanner

- [Instructor] Guess what is the next question we're going to tackle? You got it. Should I choose Cloud SQL instead of Cloud Spanner? Now the first thing we want to know is, what value does Cloud Spanner provide over Cloud SQL? And then when should I use it over Cloud SQL? And we're going to jump into that right now. So what we're going to do is we're looking directly at Google Cloud solutions webpage here, and they have a very nice article here and diagram showing you how to store data in Google Cloud. And since we're specifically talking about Cloud SQL versus Cloud Spanner, when you're looking at this decision tree, both of these are structured data, we're not talking about analytical, but we are talking about relational data. And when you move over into horizontal scaling, and this is going to be the key difference between both of these products, is that Cloud SQL, is it horizontal? Meaning it can't go all over the world and as wide and literally span across the world, where Cloud Spanner can. So those are the main differences. If you have a huge application, you need to reach folks all over the world. You need the most power, the most memory, the most hard drive space, all that good stuff, you're going to want to look at Cloud Spanner. And I'm going to show you why coming up in this next demo. Okay so let's talk about Cloud Spanner versus Cloud SQL. Now, the way to think about it is Cloud Spanner is global. Global, global, global is going to be Cloud Spanner when you're talking about relational databases. And if I were to go in here and create an instance, what you're going to see is when you get down to choose a configuration, I can choose between regional or multi-region. So if I choose regional, you're going to see the options here. So let's go, let's pick something here, let's say Northern Virginia. And as soon as I select that, you're going to see I'm going to get three read-write replicas in three separate zones. So this is going to give you that high availability that we've talked about previously, that we touched on. But what you also can do within Spanner is we can do multi-region. So if I click on multi-region, I could set up something that goes to Iowa, South Carolina, Oregon, and Los Angeles. So I have two in Iowa, two South Carolina, one Oregon, and one in Los Angeles. So this has given you that global footprint that we've talked about, and the same can be said for some of these other regions If I choose North America, Europe, and Asia, and so forth. Another thing to look at here is the nodes. So when you look at nodes, this just actually determines the actual resources behind it that power it. So the more nodes, the faster it gets. Of course the more nodes, the more expensive it gets. So you definitely want to keep an eye out on that. And then when you're looking at node count, I like on this website here under the Google Cloud Spanner docs page that one node is actually would be one in one zone. So if you look at this page here, you're seeing there's actually four in each zone. So if I had four nodes, this is what that architecture would look like. So hopefully that makes some sense with Cloud Spanner. Now we're going to go over to Cloud SQL. Now when I click Cloud SQL and we're just going to go with MySQL, the main difference you're going to see here is that you don't have those multiple regions and multiple zones all clustered together. You're just picking one region, you could pick a zone here. I can also come down and choose my database version, of course. And I'm also choosing my machine type and I'm choosing a lot more things that I'd have to set up, like the backup and high availability. Could still be done high availability on a regional basis, and then the machine type as well. So your CPUs, your memory, and all that stuff. So this is for, like I said, a much smaller scale database, but it can get rather large. I mean you could definitely bump up these specs here and change it and go up pretty high. I mean, you can take it to 96 CPUs if you want to. But that's just to give you an idea of some of the differences between Cloud SQL and Cloud Spanner.

Contents