Toad World Blog

PostgreSQL Database for Enterprises – Part I

Oct 17, 2017 2:24:00 PM by Porus Homi Havewala

In today’s brave new world, data and information of all sorts are rapidly proliferating. Many companies who have used traditional databases such as the Oracle database or Microsoft SQL Server for their data requirements since the 1990s have now started to explore new and different databases – primarily because their database license costs have been spiraling over the years, with more database servers and more CPU core licenses being required.

One strong database contender to replace the traditional large corporate database is PostgreSQL (also simply called Postgres, as a nickname of sorts). It has a double advantage in that it is provided as an open source community edition, and it is compatible with the Oracle database. This is quite attractive to companies who have been using Oracle databases, since some of their applications may install a lot of database-level code in the form of PL/SQL procedures, functions, and packages, and if the database-level code can be moved to an Oracle-compatible database, well and good. Of course, there are some applications created by Oracle such as Oracle E-Business Suite (EBS) that cannot be moved to other databases like PostgreSQL, due to their deep integration with the Oracle database.

In this article series, we will explore why and how enterprises are starting to use PostgreSQL. In particular, we will look at enterprise-powered versions of the PostgreSQL database, such as EnterpriseDB Postgres Advanced Server (EDBPAS), that are even more closely compatible with Oracle and make it easier to start using this low-cost database, either on premises or to the cloud. In the coming parts of this series, we will look more closely at the features of EDBPAS and explore installation and other features.

First, let us recap a few basic facts about PostgreSQL. Essentially, it is an open-source object-relational database that is more than 20 years old, and was inspired by the white paper "A Relational Model of Data for Large Shared Data Banks" by Edgar Frank Codd; the same paper that also influenced Oracle to create its initial relational database management system (RDBMS). PostgreSQL is owned by the Postgres foundation, and has an open source license. Because the database code is open source it can be forked and modified. It runs on the major operating systems – Linux, UNIX, and Windows. UNIX variants that can be used are IBM AIX, HP-UX, Solaris, Tru64, BSD, SGI IRIX, and macOS. The database includes most ANSI-SQL:2008 data types, and supports many of the features of the SQL:2011 standard.

1643.postgres elephant.jpg-1100x19998

PostgreSQL is supported by a large international community, mainly in postgresql.org and other countries in the world. The PostgreSQL Global Development Group regularly releases updates. On 21st September 2017, PostgreSQL 10 RC 1 was released, which is the first release candidate of the new version 10 of PostgreSQL. The database is ACID (Atomicity, Consistency, Isolation, Durability) compliant, object-oriented, and with geospatial features. There are some production PostgreSQL databases worldwide that have more than 4TB of data.

PostgreSQL, even in its open source version, has sophisticated capabilities suitable for large enterprises. One example is Multi-Version Concurrency Control (MVCC). This feature enables concurrent access to the database and avoids table locks when data is being updated by database writer sessions, with database reader sessions being able to read the previous version of the data at the same time. MVCC thus allows the database to scale to a large number of concurrent sessions without succumbing to contention between readers and writers.

As another example of its enterprise-level features, the PostgreSQL database performs Write Ahead Logging (WAL) to achieve fault tolerance and write efficiency. Due to MVCC and WAL, the PostgreSQL database can also enable online (hot) backups. The WAL feature also makes Point in Time Recovery (PITR) possible from a database backup along with the WAL log, and also enables streaming replication (asynchronous by default) between the primary and standby databases.

Nested transactions can be performed via database savepoints, and the database also boasts a powerful internal query planner (optimizer). PostgreSQL is a database that is considered to be “compatible” with the Oracle database, one reason being its own PL/SQL-compatible language. Stored procedures can be created in 12 languages, including Java, Perl, Python, Ruby, Tcl, C/C++, and PL/pgSQL, which is like Oracle’s PL/SQL. Tablespaces can be created, and the database allows partitioning to manage large tables effectively and with better performance, with a maximum table size of 32TB.

The database allows datatypes such as varchar, integer, numeric, XML, and JSON/B. The database can also enforce referential integrity with foreign keys. There are out-of-the-box functions such as to_char, to_date, and constraints such as check, not null, primary. Foreign Data Wrappers (FDW) can be used to connect to external data sources, similar to the database links available in Oracle, except that PostgreSQL can connect to different databases such as MongoDB.

User Defined Functions (UDF) can be created in  open source PostgreSQL, but an important consideration is that there are no packages (stored collections of procedures and functions) like those in the Oracle Database, and, as for reports, this has stopped a number of Oracle Database users from moving to the open source version of PostgreSQL. However, the EnterpriseDB Postgres Advanced Server distribution does allow the creation of database packages.

Now, let’s consider a large cloud company and its database offerings. Many of us are aware of Amazon AWS and the Relational Database Service (Amazon RDS) that it offers to customers around the world. Amazon allows the setup of multiple third-party databases in RDS (such as MySQL, Oracle, SQL Server, PostgreSQL, and MariaDB). Amazon’s own Aurora database was released initially with MySQL compatibility, followed by a PostgreSQL-compatible version in late 2016.

As per Amazon, this was due to customer demand and interest in PostgreSQL along with AWS optimizations for the cloud. The idea was to allow this database as an option for new greenfield deployments, or even migration from other existing databases in the company such as Oracle or SQL Server. Amazon now offers Aurora as PostgreSQL 9.6 on the Amazon Aurora cloud-optimized storage.

But what are the benefits of EnterpriseDB Postgres Advanced Server (EDBPAS) as compared to the Aurora version? We continue in the next part of this article series, when we will look more closely at the features of EDBPAS, and then explore the installation and other aspects of this distribution, which is fast becoming popular around the world.

Tags: PostgreSQL Postgres EnterpriseDB

Porus Homi Havewala

Written by Porus Homi Havewala

Porus Homi Havewala is a Double Oracle Certified Master (OCM) in 11g and 10g. He was awarded the prestigious "Oracle ACE Director" title by Oracle USA in 2008. He worked as the Strategic Program Advisor at Oracle Corporation Singapore, and is a regional SME on Oracle Enterprise Manager technology, specifically concentrating on private/hybrid Database cloud capabilities on Oracle systems.

Porus has worked prominently for a number of years at the largest telecommunications company Telstra in Australia, where he personally set up and managed the first production Enterprise Manager Grid Control 10g project in the world in the early 2000s, controlling thousands of Data Center targets with multiple Administrator teams around Australia. He has 26+ years of experience in the IT industry, and 18+ years of experience with Oracle Technology, including as an Oracle Developer and Oracle Senior DBA.

He is the creator and manager of the Enterprise Manager blog with Oracle Press Credentials, the Clouds and Databases blog, and the "Oracle Senior DBA" group on LinkedIn.com with 61,000+ members. Porus is the author of thirteen published technical articles and three white papers on Enterprise Manager in the Oracle Technical Network (OTN), and has authored a number of Enterprise Manager Books. He started his technical writing with a book on Microsoft Foxpro as early as 1994. His recent Enterprise Manager books are as follows: Oracle Enterprise Manager Cloud Control 12c: Managing Data Center Chaos published by PACKT Publishing, and the latest book Oracle Database Cloud Cookbook with Oracle Enterprise Manager 13c Cloud Control published by Oracle Press.

Dedication: I dedicate my pen and all its output to my beloved parents in heaven, they are the ones that have taught me the good values in life.

Disclaimer: My writings in blog entries, articles or books express my views and opinions in my personal capacity and not that of Oracle Corporation.