Massive Parallel Processing with Alibaba Cloud HybridDB for PostgreSQL

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用系列 2核4GB
简介: When you have massive amounts of data and the need for data analytics, or you have high availability requirements, or security and backup protocols to.

DataWarehouse_FriendlyDatabaseDesign

When you have massive amounts of data and the need for data analytics, or you have high availability requirements, or security and backup protocols to follow, services like Alibaba Cloud's HybridDB for PostgreSQL can come in handy.

The service takes powerful Relational Database Management Systems (RDBMS) to a whole new level. In this article, we are going to explore how to get started with Alibaba Cloud's HybridDB for PostgreSQL service—for free.

PostgreSQL

PostgreSQL (also known as Postgres) is considered the most advanced open-source database, for several reasons. In the old world of databases—systems that organize, describe, store, structure and let users query data—there are several players that require costly licensing agreements. But there are also some players that deliver an interesting balance between features—and now, scaling. Postgres, with the help of Alibaba Cloud HybridDB, is one of these.

Postgres is formally a RDBMS, which means that it solves the problem of organizing data based on the relational model invented by Edgar Codd. Since version 8.0 launched in 2005, it has evolved to cover new spaces—including some non-structured data—and now, in version 10, launched this year, Postgres offers:

● XML data types, which let you store XML documents as columns of a table, query tags and attributes, convert to-from XML, and more
● JSON data types, allowing storage of JSON documents as columns of a table, queries of documents, conversion to/from JSON, the addition of indexes to improve performance, and more
● HStore data types, meaning that you can define key-value columns in the tables
● GIS extensions, allowing specialized datatypes, indexes, and a bunch of utilities for GeoSpatial use cases
● Basic full-text search capabilities
● Query parallelization

The last one is special because it makes available to the local developer (and usually the dev environment) the capacity to launch complicated queries which will be optimized to run in parallel, using the full capabilities of multiple core processors. But how is the same thing accomplished when the amount of data is in the order of terabytes, or petabytes? It's called Massive Parallel Processing—and one solution is to use a cluster of databases that can share the load and offer one single interface that looks as if it were a single database instance.

From the database world to the cloud

Running a database cluster is a complicated task, and usually, there is a specific role (better, a specific team) in the company that handles this. There are innumerable important details and a huge amount of subtasks that you need to handle to offer a reliable, scalable and blazing fast service. Fortunately, companies like Alibaba Cloud offer this kind of service, and you can jump from zero to a decent cluster configuration without being a specialist.

The Greenplum open source project is a Massive Parallel Processing Database based on PostgreSQL 8.2. Alibaba Cloud's HybridDB is one cloud provider that offers a service to run Greenplum and manage tasks such as security and backup. What are the advantages?
Here are a few:

● Autoscaling
● Simplified management
● Isolation of the environment using virtual private clouds
● Exclusive extensions to the Greenplum base implementation, such as JSON and HyperLogLog
● Support of Open Storage Service
● Support of migration tools such as pgsql2pgsql (PostgreSQL to PostgreSQL) or mysql2pgsql (MySQL to PostgreSQL)
● Support for SQL-99, SQL-03, SQL-08 standards
● Support of the Apache MADlib project

The last one is particularly interesting because it extends HybridDB for PostgreSQL with "data-parallel implementations of mathematical, statistical and machine learning methods for structured and unstructured data," which means that you will be able to do advanced analytics on data locally, in-database.

Hands-on

Let's take a look at this solution by creating an account at Alibaba Cloud, and taking advantage of the $300 (USD) credit that they offer for new users. (The registration process is simple, so it will not be explained in detail here.) The idea is that you create an instance which is a compound of groups of databases (at least 2) that will share the same CPU, IO, memory, and disk resources. (Keep in mind that the resources in one group are allocated to the same physical host.) Go to the console and click on "HybridDB for PostgreSQL":

01

Click on the button in the upper-right corner labeled "Create an Instance":

02

Select the Region, Zone and Instance Class:

03

Confirm your order:

04

After a few seconds, your instance will be created. Then, click on the "Manage" link at the end of the row:

05

We are going to configure access to the instance through the Internet because this is just a sample. (This setup is highly risky, and you should avoid it in your project's setup. Please read the security guides and collaborate with your IT security team before configuring an instance.)

Next, click on the link "Security Controls" on the left panel, and create a new white list group by clicking the "Add White List Group" button on the right. Call it "internet" with the white list set to "%" (which means any IP address):

06

After the security (mis) configuration is complete, we are going to create a new database user account. Click on the "Account Management" link on the left panel, and then the "Create account button":

07

Fill in the details. Your password must contain uppercase and lowercase letters, symbols and numbers. (If you forget the password, you can reset it from the console.) Click the "OK" button. In order to get an Internet address for the instance, click on the "Database Connection" link on the left panel, and click the button "Apply for Internet address." (Again, this IS NOT A RECOMMENDED practice as it is highly risky.)

08

Now we are going to test the setup using PgAdmin III as the client. (You can use JDBC, ODBC, PSQL, Python, libpq, etc.) Register a new server and fill in the details. Pay special attention to the "Host"— yourgpdbaddress.gpdb.rds.aliyuncs.com; "Port"— shown at the instance details console—along with the "Username" and "Password" that you have already configured, and click the "OK" button:

09

After the setup, you can import your data with OSS, mysql2pgsql, pgsql2pgsql, or another tool, and start playing. Don't forget to check out the documentation about the capabilities of the Greenplum project and the extensions supported by Alibaba Cloud's HybridDB for PostgreSQL.

Alternatives

There are multiple approaches to achieving Massive Parallel Processing. HybridDB is one of them, but the market offers additional alternatives such as CitusData, Snowflake Cloud Data Warehouse, and Amazon Redshift, among others. If you have a use case that will benefit from a MPP solution, choose your provider wisely.

Final words

With a little effort, and after reading some documentation, it's pretty simple to set up a basic database cluster using Alibaba Cloud's HybridDB for PostgreSQL. The console and management services are simple and intuitive. The ability to set up the environment for Massive Parallel Processing solutions with a few clicks, keeping compatibility with one of the most advanced database engines and useful extensions, certainly looks very promising, but there are some points that could use some polishing, like the localization of management tools and the written documentation. It is always good to have more alternatives to tackle new Big Data quests.

To try Alibaba Cloud for free, you can take advantage of their current offer of $300 in free credits.

Bio

Nicolas Bohorquez (@Nickmancol) is a software developer from Colombia and is currently earning a Master's in Data Science for Complex Economic Systems at the Collegio Carlo Alberto in Turin, Italy. Previously, Nicolas has been part of development teams in a handful of startups, and has founded three companies in the Americas. He is passionate about the modeling of complexity and the use of data science to improve the world.c

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
SQL 分布式计算 并行计算
PostgreSQL 并行计算解说 之1 - parallel seq scan
标签 PostgreSQL , cpu 并行 , smp 并行 , 并行计算 , gpu 并行 , 并行过程支持 背景 PostgreSQL 11 优化器已经支持了非常多场合的并行。简单估计,已支持27余种场景的并行计算。 parallel seq scan parallel index scan parallel index only scan
4957 0
|
Java 关系型数据库 数据库
五分钟带你玩转spring cloud alibaba(三)定制postgresql版本的nacos
五分钟带你玩转spring cloud alibaba(三)定制postgresql版本的nacos
428 0
五分钟带你玩转spring cloud alibaba(三)定制postgresql版本的nacos
|
SQL 存储 Oracle
PostgreSQL 分页, offset, 返回顺序, 扫描方法原理(seqscan, index scan, index only scan, bitmap scan, parallel xx scan),游标
PostgreSQL 分页, offset, 返回顺序, 扫描方法原理(seqscan, index scan, index only scan, bitmap scan, parallel xx scan),游标
3865 0
|
SQL 存储 弹性计算
PostgreSQL 分页, offset, 返回顺序, 扫描方法原理(seqscan, index scan, index only scan, bitmap scan, parallel xx scan),游标
标签 PostgreSQL , 数据离散性 , 扫描性能 , 重复扫 , bitmap index scan , 排序扫描 , 扫描方法 , 顺序 背景 一个这样的问题: 为什么select x from tbl offset x limit x; 两次查询连续的OFFSET,会有重复数据呢? select ctid,* from tbl where ... offset 0 li
2130 0
|
SQL 分布式计算 并行计算
PostgreSQL 并行计算解说 之10 - parallel 自定义并行函数(UDF)
标签 PostgreSQL , cpu 并行 , smp 并行 , 并行计算 , gpu 并行 , 并行过程支持 背景 PostgreSQL 11 优化器已经支持了非常多场合的并行。简单估计,已支持27余种场景的并行计算。 parallel seq scan parallel index scan
1702 0
|
SQL 分布式计算 并行计算
PostgreSQL 并行计算解说 之13 - parallel OLAP : 中间结果 parallel with unlogged table
标签 PostgreSQL , cpu 并行 , smp 并行 , 并行计算 , gpu 并行 , 并行过程支持 背景 PostgreSQL 11 优化器已经支持了非常多场合的并行。简单估计,已支持27余种场景的并行计算。 parallel seq scan parallel
653 0
|
SQL 分布式计算 并行计算
PostgreSQL 并行计算解说 之14 - parallel index scan
标签 PostgreSQL , cpu 并行 , smp 并行 , 并行计算 , gpu 并行 , 并行过程支持 背景 PostgreSQL 11 优化器已经支持了非常多场合的并行。简单估计,已支持27余种场景的并行计算。 parallel seq scan paral
1208 0
|
SQL 分布式计算 并行计算
PostgreSQL 并行计算解说 之15 - parallel bitmap scan
标签 PostgreSQL , cpu 并行 , smp 并行 , 并行计算 , gpu 并行 , 并行过程支持 背景 PostgreSQL 11 优化器已经支持了非常多场合的并行。简单估计,已支持27余种场景的并行计算。 parallel seq scan
1286 0
|
SQL 分布式计算 并行计算
PostgreSQL 并行计算解说 之16 - parallel index only scan
标签 PostgreSQL , cpu 并行 , smp 并行 , 并行计算 , gpu 并行 , 并行过程支持 背景 PostgreSQL 11 优化器已经支持了非常多场合的并行。简单估计,已支持27余种场景的并行计算。 parallel seq scan
787 0
|
SQL 分布式计算 并行计算
PostgreSQL 并行计算解说 之17 - parallel nestloop join
标签 PostgreSQL , cpu 并行 , smp 并行 , 并行计算 , gpu 并行 , 并行过程支持 背景 PostgreSQL 11 优化器已经支持了非常多场合的并行。简单估计,已支持27余种场景的并行计算。 parallel seq scan
413 0