PostgreSQL: The Underappreciated Database
Many corporations are undergoing migrations from on-premises IT infrastructure to cloud-based platforms. Similarly, many are reevaluating the benefit of the high cost of licensed software, notably Oracle relational database management system (RDBMS). Often relational database conversions look no further than No-SQL solutions or various flavors of MySQL. Before making your decision, look into PostgreSQL solutions, particularly Amazon Web Service (AWS) PostgreSQL Relational Database Service (RDS) and Aurora PostgreSQL RDS.
When migrating an existing Oracle database to AWS there are several options available: host the database on a custom configured EC2, transfer the data to an Oracle RDS, or convert the database to be migrated to a different AWS data service. Neither a custom-built EC2 nor an Oracle RDS saves any Oracle license costs, further, the Oracle CPU based licensing will prevent the system from taking advantage of AWS’s scaling capabilities.
Converting an Oracle database to a No-SQL is highly dependent on how the current database is being used. Oracle and other RDBMSs focus on ACID (atomicity, consistency, isolation, and durability) compliance; No-SQL is focused on performance at the expense of cross-transaction consistency and data normalization.
Converting the Oracle database to one of the three open-source data engines available in RDS (PostgreSQL, MySQL, and MariaDB) provides freedom from licensing cost, the ability to scale to usage, leveraging the benefits of database-as-a-service (DBaaS); while managing the data in a relational fashion similar to Oracle.
PostgreSQL is an open-source relational database designed to be highly extensible and compliant. MySQL, and by extension MariaDB which is a fork of the MySQL source, is a light-weight data engine focused on high-performance of simple structures. While very valuable in many use-cases, MySQL and MariaDB do not provide many capabilities available in Oracle and PostgreSQL. PostgreSQL offers a high degree of data structure compatibility with Oracle. Most of the differences can be addressed with refactoring; however, some such as lack of autonomous transactions may require a moderate development effort to handle in PostgreSQL.
What is Relational Database Service (RDS)?
RDS is Amazon’s DBaaS offering. As mentioned above RDS supports several open sources and licensed database engines with highly flexible scalability and performance options. Amazon has automated installation, configuration, and replication tasks to allow relational databases to be managed as simply as any other cloud service. RDS can even automate patch application. This allows database administrators and developers to focus on their applications and also allows these databases to be handled as infrastructure-as-code.
What is Aurora?
Amazon Aurora pairs MySQL and PostgreSQL data engines with a re-engineered cloud-based storage solution that significantly improves the performance and durability of the engines. Each Aurora database is backed by six storage devices distributed across three Availability Zones. This redundant storage is billed at the same rate as a single EBS volume of the requested size. Distributing the storage brings a degree of parallel processing and redundancy not available with RDS. Aurora is designed to compete with enterprise production deployments backed by high durability, high-performance storage architecture.
As described by Amazon:
Amazon Aurora combines the performance and availability of high-end commercial databases with the simplicity and cost-effectiveness of open source databases. It provides up to five times better performance than the typical MySQL database and three times the performance of the typical PostgreSQL database, together with increased scalability, durability, and security. For more information, please visit the Amazon Aurora product page, and view the AWS Region Table for regional availability.
Reviewing Amazon’s pricing, Aurora instances only cost about 20% more per hour than a single EC2 or RDS of the same size. A system can get Regional level durability with three to five times the performance with only a 20% increase to hardware costs and no additional licensing. This has significant benefits when considering production deployments.
Why not Oracle?
Oracle RDBMS is the leading relational database engine. The Enterprise edition includes numerous features to optimize performance, meet a broad range of capability and security needs, and provide for maximum availability and durability. These capabilities can be further extended to an impressive degree with their Engineered Systems and others for cost options. The annual support costs provide access to security patches.
With such a strong offering, why not use Oracle? Essentially, cloud automation and the maturity of PostgreSQL databases have tipped the scales such that Oracle’s licensing and support costs now outweigh the benefits of the data engine. Further, many applications using the Oracle engine do not use nor need many of the advanced features provided by the engine. Let’s take a quick look at the money with a standard single instance (server) example:
Oracle licensing is processor-based and AWS uses Intel chipsets so we’ll focus on those metrics.
Oracle Enterprise Server License Purchase $47,500/CPU*
Annual Support $10,450/CPU*
*Intel chipsets have a Processor Core factor of 0.5 for Oracle Licensing consideration.
Since this discussion focuses on migrating to the cloud, we’ll ignore on-premises hardware and software purchase price and focus only on the annual Oracle support fee. However, on-premises licensing, hardware, power, and facilities are certainly non-trivial expenses.
We’ll consider an on-premises hosted Oracle server, a custom-built Oracle EC2 server in AWS, and PostgreSQL RDS. We’ll use an AWS On-Demand db.r5.4xlarge PostgreSQL RDS instance which amounts to 16 vCPU and 128 GB RAM on Amazon Linux. We’ll assume 500 GB for database storage and ignore backup storage for simplicity (I challenge anyone to prove that a Storage Are Network or Tape device is more cost-effective than snapshots stored in S3).
Annual cost for a single instance (development) database server:
Oracle Support $10,450/CPU * 16 * 0.5 core factor = $83,600
Server Cost = Already purchased and operations expense is external
Storage Cost = Already purchased and operations expense is external
Total Annual Cost: $83,600
Oracle on EC2:
Oracle Support $10,450/ CPU * 16 * 0.5 core factor = $83,600
Server Cost = r5.4xlarge @ $1.008/hr * 24 * 365 = $8,830.08
Storage Cost = General Purpose SSD @ $0.10 per GB-month * 500GB * 12 = $600
Total Annual Cost: $93,030.08
Before looking at PostgreSQL, notice the cost of the on-premises Oracle and the EC2 Oracle. This is an example of why it is difficult to realize a cost/performance improvement with fork-lift cloud migration (one without significant architectural changes). One key reason is that a single physical CPU performs better than a vCPU, yet the vCPU requires the same Oracle license.
To truly achieve benefits of cloud migration, some fundamental changes need to be made, typically yielding improvement across the whole system.
Oracle Support = N/A
Server Cost = r5.4xlarge @ $2.00/hr * 24 * 365 = $17,520
Storage Cost = General Purpose SSD @ $0.10 per GB-month * 500GB * 12 = $600
Total Annual Cost: $18,120
After a quick comparison, Oracle is five times more expensive than a fully managed PostgreSQL database.
Is your Oracle deployment performing five times better than a PostgreSQL database can?
Aside from the licensing costs, cloud-based hardware inherently brings a phenomenal level of durability that needs to be engineered into an on-premises or custom EC2 environment. Any hardware issue is resolved with a server reboot. What happens when capacity needs to be increased? Only the hardware hourly rate increases for PostgreSQL RDS or Aurora. Increasing server size with Oracle means purchasing additional licenses at $47k/CPU* and $10k/CPU* per year after that. In addition to the increased hardware cost.
What about Production?
PostgreSQL made an impressive showing in the development example, saving $60k annually. In Production, outages, poor performance, and data loss are unacceptable. Aurora was designed to answer these concerns and leverage cloud capabilities to the database’s benefit. Oracle has an impressive reputation in these areas of on-premises. However, many of the tools Oracle provides to answer these concerns are individually licensed.
Aurora increases the throughput of a PostgreSQL database by a factor of three. Aurora natively mirrors data six times across three Availability Zones (AZ). To match this capability with Oracle would require Automatic Storage Management (ASM), Active Data Guard and three EC2 instances in separate AZs.
Considering our example above, instead of paying around $22k annually for your Aurora PostgreSQL, you’d pay nearly $300k plus Active Data Guard licenses. Oracle is more than ten times the cost of PostgreSQL Aurora. Consider again, is your Oracle deployment performing ten times better than a PostgreSQL Aurora database can?
AWS leverages its infrastructure to provide managed database-as-a-service that can exceed on-premises performance, durability, and scalability while only charging for the resources used. The savings in licensing, manpower, and hardware failure will easily offset the cost of converting from Oracle. At UNCOMN we have the experience and know-how to help your cloud migration succeed. For more information please contact us at: firstname.lastname@example.org.
About the Author: Joshua Lowary
Joshua is a database administrator and architect with over 15 years of experience in Oracle, Teradata, and PostgreSQL. In his personal time, Joshua enjoys spending time with his wife and two children, exploring the galaxy of EvE Online, and perfecting his recipes for home-brewed ales and sake.