Journey from an
Oracle DBA
to a PostgreSQL DBA
11th June 2015
Disclaimer: The views expressed in this presentation are my own and does not represent the views of my company
Topics
1. About Me
2. Differences between Oracle & PostgreSQL
3. Personal experience with PostgreSQL
Topics
1. `whoami`
2. Difference between Oracle & PostgreSQL
3. Personal experience with PostgreSQL
`whoami`
● Ang Wei Shan
● Database Administrator
● 3 years in Oracle
● 1 year in SQL Server & DB2
● <2 months in PostgreSQL
● GMO GlobalSign
Topics
1. About Me
2. Differences between Oracle & PostgreSQL
3. Personal experience with PostgreSQL
Introduction
All comparisons are done using Oracle Database 11gR2 and PostgreSQL 9.3
● Relational*
● ACID compliant
● Proprietary Licensing
● 35 years of active development
● “Owned” by a man who has an island
Oracle
● Relational*
● ACID compliant
● Open-Source
● 25 years of active development
● Runs by core team of 6 from different
companies
PostgreSQL
Basic Concepts
● Database is a set of files, located on disk
that stores data
● Instance is set of memory and processes
● Database <=== Instance
● A database may be accessed by 2 instances
at the same time.
Oracle
How does Oracle comply with ACID
● Atomicity
● Consistency
● Isolation
● Durability
Oracle - Undo and Redo Log
● Roll back transactions when a ROLLBACK statement is issued
● Recover the database
● Provide read consistency
● ORA-01555 Snapshot too old error
● Redo log consists of all the changes to the DB (Change Vector)
● All transactions will write to redo logs before committing
● Redo logs will contain Undo information
● Together, they can reconstruct all changes to the DB
● Database cluster - A collection of databases
that is stored at a common file system
location ($PGDATA).
● 1 database cluster may contain 1 or more
databases
● Database cluster <=== Database
PostgreSQL
● Atomicity
● Consistency
● Isolation
● Durability
How does PostgreSQL comply with ACID
● Every transaction gets an incremental XID.
● Insert’s XID are called xmin (Update/Delete gets xmax)
● Every row that has been committed and xmin lesser than current
XID are visible to current TX
● Rows that are deleted are not removed but marked as deleted. The
rows that are deleted might still be required by other TX
● Will cause bloat-ness if not taken care off properly
● Vacuum will clean up unused rows (XID wraparound, ~4 bill rows)
● WAL are similar to Oracle’ redo logs
PostgreSQL - MVCC
Basic Architecture
Oracle
PostgreSQL
Topics
1. About Me
2. Differences between Oracle & PostgreSQL
3. Personal experience with PostgreSQL
● Partial Index
● Python in database
● Foreign Data Wrapper
● Session level settings (isolation, replication)
● Easy to manage (l+, d+)
● User-defined data type
● Plenty of extensions to do more advance stuff (WAL-E,
Barman, pg_repack...)
PostgreSQL Yay! :)
● No built-in parallelism
● No hints in DML query
● No advance security features
● No advance compression
● No default connection pooling
● Less mature replication technology
PostgreSQL Nay :(
Overall Thoughts
Require much more experienced people to
manage open-source than proprietary
technology. There are many different ways of
doing the same thing.
Oracle definitely beats PostgreSQL in terms of
technology…. But are you willing to pay USD
>45k per core license?
I would prefer to use it for free, find solutions
and work around the limitations. That is, after
all, the job of an engineer.
Thank you
weishan.ang@gmail.com
sg.linkedin.com/in/weishan
newbiedba.wordpress.com

PUGS Meetup Presentation - 11062015

  • 1.
    Journey from an OracleDBA to a PostgreSQL DBA 11th June 2015 Disclaimer: The views expressed in this presentation are my own and does not represent the views of my company
  • 2.
    Topics 1. About Me 2.Differences between Oracle & PostgreSQL 3. Personal experience with PostgreSQL
  • 3.
    Topics 1. `whoami` 2. Differencebetween Oracle & PostgreSQL 3. Personal experience with PostgreSQL
  • 4.
    `whoami` ● Ang WeiShan ● Database Administrator ● 3 years in Oracle ● 1 year in SQL Server & DB2 ● <2 months in PostgreSQL ● GMO GlobalSign
  • 5.
    Topics 1. About Me 2.Differences between Oracle & PostgreSQL 3. Personal experience with PostgreSQL
  • 6.
    Introduction All comparisons aredone using Oracle Database 11gR2 and PostgreSQL 9.3
  • 7.
    ● Relational* ● ACIDcompliant ● Proprietary Licensing ● 35 years of active development ● “Owned” by a man who has an island Oracle
  • 8.
    ● Relational* ● ACIDcompliant ● Open-Source ● 25 years of active development ● Runs by core team of 6 from different companies PostgreSQL
  • 9.
  • 10.
    ● Database isa set of files, located on disk that stores data ● Instance is set of memory and processes ● Database <=== Instance ● A database may be accessed by 2 instances at the same time. Oracle
  • 11.
    How does Oraclecomply with ACID ● Atomicity ● Consistency ● Isolation ● Durability
  • 12.
    Oracle - Undoand Redo Log ● Roll back transactions when a ROLLBACK statement is issued ● Recover the database ● Provide read consistency ● ORA-01555 Snapshot too old error ● Redo log consists of all the changes to the DB (Change Vector) ● All transactions will write to redo logs before committing ● Redo logs will contain Undo information ● Together, they can reconstruct all changes to the DB
  • 13.
    ● Database cluster- A collection of databases that is stored at a common file system location ($PGDATA). ● 1 database cluster may contain 1 or more databases ● Database cluster <=== Database PostgreSQL
  • 14.
    ● Atomicity ● Consistency ●Isolation ● Durability How does PostgreSQL comply with ACID
  • 15.
    ● Every transactiongets an incremental XID. ● Insert’s XID are called xmin (Update/Delete gets xmax) ● Every row that has been committed and xmin lesser than current XID are visible to current TX ● Rows that are deleted are not removed but marked as deleted. The rows that are deleted might still be required by other TX ● Will cause bloat-ness if not taken care off properly ● Vacuum will clean up unused rows (XID wraparound, ~4 bill rows) ● WAL are similar to Oracle’ redo logs PostgreSQL - MVCC
  • 16.
  • 17.
  • 19.
  • 21.
    Topics 1. About Me 2.Differences between Oracle & PostgreSQL 3. Personal experience with PostgreSQL
  • 22.
    ● Partial Index ●Python in database ● Foreign Data Wrapper ● Session level settings (isolation, replication) ● Easy to manage (l+, d+) ● User-defined data type ● Plenty of extensions to do more advance stuff (WAL-E, Barman, pg_repack...) PostgreSQL Yay! :)
  • 23.
    ● No built-inparallelism ● No hints in DML query ● No advance security features ● No advance compression ● No default connection pooling ● Less mature replication technology PostgreSQL Nay :(
  • 24.
  • 25.
    Require much moreexperienced people to manage open-source than proprietary technology. There are many different ways of doing the same thing.
  • 26.
    Oracle definitely beatsPostgreSQL in terms of technology…. But are you willing to pay USD >45k per core license?
  • 27.
    I would preferto use it for free, find solutions and work around the limitations. That is, after all, the job of an engineer.
  • 28.