Databases are an integral element of every application or IT system. If you want your data to be accessible from any place at any time, a fully managed database service like Google Cloud SQL is a great choice.
What is a database?
Data collection
Data are collections of numbers and texts in various forms. In computer science, data are objects on which programs operate. For example, the data is your name, surname and telephone number, and the processing “program” is the telephone book (a classic example of a database).
Database – organizing data
It retains new information and changes introduced by users, other devices or processes (e.g. on Internet of Things platforms). They allow websites to store user information so that you don’t need to fill out your profile every time you log in. Once entered, the user’s name, surname, and other data is safeguarded by data encryption.
Databases are crucial in, among others:
- e-commerce,
- making deposits and withdrawals in banks,
- accounting,
- maintaining the level of assortment in stores,
- managing production lines.
A database is an ordered information storage system. The data is systematized, making it easier to manage.
Different types of data organization
Data collected and processed in IT systems or applications are often more complex than a list of names with an assigned telephone number. They can be hundreds of terabytes in size, and many types of databases have been created to collect and maintain the records. Currently, database systems can be divided according to the ways of organizing data:
Card databases
In the card database, each table is an independent document and cannot cooperate with other tables, but the data in the card database can be sorted and filtered; an example of a card database is a spreadsheet containing a list of book titles with the author’s name and year of publication.
Hierarchical databases
In hierarchical databases data is stored on the basis of parent-child records, and the structure of a hierarchical database resembles a tree with branches.
Relational databases
In relational databases, tables are interrelated and can cooperate with each other, and obtaining the necessary information is not complicated; SQL is used to operate on data in relational databases.
Object-oriented databases
Their system is similar to object-oriented programming, and data is defined and stored in accordance with the object-oriented model.
Stream databases
They operate on data streams and implement continuous query languages based on SQL.
Temporal databases
Databases with information about the time of data entry and validity period; are often administered automatically by deleting or archiving outdated data.
Graph databases
Using graph structures with nodes, edges and properties to present and store data and handle semantic queries; graph databases are most often used for models and networks where relationships cannot be easily presented using tables – e.g. in social media.
Non-relational databases
NoSQL databases in which there are no tables and relations, and the data does not have to be homogeneous in terms of structure.
The most commonly used databases in programming are relational databases. Relational databases have internal programming languages that use SQL (Structured Query Language) to operate on data and create advanced service functions. The most popular relational databases are MySQL, PostgreSQL and SQL Server.
What is Cloud SQL?
Cloud SQL is a service Google Cloud. It is a database service in the cloud, or database-as-a-service (DBaaS). Data in the database is stored and processed in the cloud, on the cloud service provider’s infrastructure, and access is provided from the Google Cloud Platform console or command line.
This means that the application owner can use the computing power of Google Cloud, do not waste time maintaining their own infrastructure, and easily connect the cloud database service with other GCP services – for example virtual machines or the Kubernetes container management service.
Google cloud database
Cloud SQL is part of the Google Cloud Platform cloud infrastructure. GCP is a scalable and flexible solution, with high performance and high service availability.
All Google Cloud machines are managed by the service provider. This means that when using the cloud, you do not have to waste time on maintaining or updating equipment, and you can use serverless services available in many regions and locations.
Data transfers
Google Cloud creates its own network of fiber optic connections between data centers, which may be important especially for owners of global applications. The transfer speed via the Google network reaches up to 10Tbs, which allows you to increase efficiency while maintaining the same price for the service. In addition, Google Cloud guarantees service availability at the level of 99.95-99.99%, which is the highest SLA among popular cloud service providers.
This means that Cloud SQL, as one of the GCP services, is a serverless, scalable service that ensures high availability and performance. And cost flexibility, because Google Cloud computing power consumption is counted on a per-second basis (as you will read about in a moment).
You can read more about GCP in the articles:
- What is Google Cloud Platform and how it supports business
- 20 reasons to choose GCP cloud infrastructure
Wide possibilities of instance configuration
In Cloud SQL, we can precisely configure instances for each database system. Configuring the service to meet the application requirements will have an impact on performance, but also on price.
When creating an instance, we can choose:
- region and location of the new instance,
- type of virtual machine, its memory and CPU; we can choose from shared-core machines, standard machines and machines with a large amount of memory;
- disk – SSD, with higher speed and higher QPS (query per second) or HDD, with a lower price;
- capacity (data space) ranging from 10 to 30720 GB; you can also set automatic (permanent) increase in space when necessary.
Service scalability and cost flexibility
Because Cloud SQL uses Google Cloud computing power, the cost is based on storage space used and consumption per second. If there are few database queries and consumption is not high, the cost of the service will be lower. When the application is loaded (e.g. it is used by several times more users than usual), the service will scale up and Cloud SQL will handle all queries without any problems. The use of computing power will be higher and the cost of the service will be proportional to the consumption.
The price of the service also depends on your database system, instance configuration or region. However, in each case, the cost is charged for actual consumption, not for “rented” resources.
Reducing maintenance costs thanks to automation
As I mentioned, Google Cloud Platform services are fully managed – Cloud SQL too. The Google team takes care of the condition of the physical infrastructure, which allows the user to transfer maintenance costs to the development zone (in the case of Arena.pl, switching to Google Cloud Platform allowed to reduce internal infrastructure maintenance costs by 20-30% –see case study). Service automation not only helps reduce internal costs, but also protects against errors.
There are many automations that can be implemented in Cloud SQL to ease the burden on your technical team. You can automate, among others:
- database administration,
- managing database capacity and optimizing disk space,
- backing up and restoring data.
Automatic backup
Already at the instance configuration stage, GCP allows you to indicate the time window in which the automatic backup will be performed. The second recommended option is to recover data with split-second accuracy thanks to binary logs. The backup can be stored in a different region than the instance is located. Backup storage costs per gigabyte of data per month; the height depends on the database system, region and instance configuration.
Data security in Cloud SQL
Cloud SQL is compliant with SSAE 16, ISO 27001, PCI DSS and HIPAA security standards. Data is encrypted at rest and in transit (encryption in transit). Cloud SQL supports connectivity to the Virtual Private Cloud, and each instance has a firewall that allows you to control access to the public network. A cloud database can only connect to a public network via SSL or Cloud SQL Proxy.
Easy integration with other GCP services
You can connect applications outside the Google Cloud environment to Cloud SQL. However, by having the entire application or a large part of it in the Google cloud, you can achieve more, for example thanks to connections between services.
Cloud SQL will work seamlessly with other services from the Google Cloud Platform range, including the Compute & Serverless group: Compute Engine, App Engine, Kubernetes Engine, Cloud Run or Cloud Functions. You can engage to quickly query the database and conduct instant analyticsBigQuery (data warehouse service) with solutions such as:
- BigQuery ML – enabling the creation and running of machine learning models in a data warehouse,
- BigQuery GIS – analyzing geospatial data (GIS – Geographic Information Systems),
- or BigQuery BI Engine – a service for immediate in-memory analysis integrated with Google Data Studio.
You can read more about connecting Cloud SQL with BigQuery on the Google Cloud website:Cloud SQL federated queries.
Quick launch and easy migration
A Cloud SQL instance can be easily created and configured from the Google Cloud console. The whole process consists of a few clicks and completing a few fields. You will learn how easy it is to set up a Cloud SQL instance in the tutorial below.
Once the service is configured and running, you can move your database to Cloud SQL. The process is clearly described in the console, and the service has built-in migration tools. Migration is not burdensome (in many cases, you do not even need to make changes to the application code), but importing the database itself may take some time.
How much does Cloud SQL cost?
Payments for the Cloud SQL service depend on consumption and space occupied. The final price depends on several factors, including:
- database system used – fees are different for MySQL, for PostgreSQL and different for SQL Server,
- region and location of the instance,
- CPU and memory of the virtual machine,
- disk type and space used,
- high availability option
- network and data transfer method,
- licenses held.
You can calculate the final cost of the service in Google Cloud calculators or contact the FOTC for an estimate.
Find out more about Google Cloud Platform.