When comparing Google Cloud SQL vs DynamoDB, the Slant community recommends DynamoDB for most people. In the question“What are the best DBaaS for Event Sourcing?” DynamoDB is ranked 2nd while Google Cloud SQL is ranked 4th. The most important reason people chose DynamoDB is:
DynamoDB offers a free tier which allows up to 40 million database operations a month for free.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Supports automatic encryption
Google Cloud SQL automatically encrypts all tables and temporary files.
Pro Free tier
DynamoDB offers a free tier which allows up to 40 million database operations a month for free.
Pro Trigger tasks (AWS Lambda) on write
When a new record is written, it can trigger one or many AWS Lambda functions. With Lambda functions in Java, JavaScript, and Python and the other con of "Easy integration with other Amazon services", Lambda functions may be all you need to process the events. This is particularly useful for creating projections (often as other DynamoDB tables) and other read models in a CQRS pattern.
Pro High uptime
Data hosted on DynamoDB is automatically replicated across multiple AWS availability zones, this way the data is protected from any malfunction that may cause loss and it also ensures high uptime.
Pro Easy integration with other Amazon services
Since it's part of AWS, like with other services that Amazon provides, it's very easy to integrate DynamoDB with any other AWS service that you may be using.
Cons
Con AWFUL data integrity practice: Backup lifecycle is tied to instance lifecycle
If you are using Google CloudSQL, you are one command away from losing everything:
gcloud sql instances delete prod-instance-name
When you delete a CloudSQL instance, it also deletes the back-ups associated with that instance along with it. So if you accidentally delete your production database: Your backups? Poof. Gone.
It says this in the fine print of the on-demand backups documentation: https://cloud.google.com/sql/docs/mysql/backup-recovery/backups#about_on-dem
They persist until you delete them or until their instance is deleted.
There is also no way to mark a CloudSQL instance as "protected" so one bad CLI command can lose you your production database and all backups.
In order to get an actual backup workflow that will not affect production traffic, you must:
Don't fall for it. Protect your production data. Avoid busywork caused by poor product design. Avoid Google CloudSQL.
Con Performance limits
There are some performance limits when dealing with transactions for Google Cloud SQL.
Con No specific features for Event Sourcing
DynamoDB is just a general purpose NoSQL database; hence, there are no features specific to the domain of Event Sourcing, such as event ordering or projections. As a developer, you will need to decide how to implement these.
Con Poor documentation
In true AWS fashion, the documentation for DynamoDB is not top notch. While the learning curve is generally very soft and it's not hard to learn, you need to have at least some experience with cloud and database management to be able to start using DynamoDB and understand the documentation.