pugs meetup presentation - 11062015

Post on 14-Jan-2017

320 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Journey from an Oracle DBA

to a PostgreSQL DBA11th 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 youweishan.ang@gmail.com

sg.linkedin.com/in/weishannewbiedba.wordpress.com

top related