pugs meetup presentation - 11062015

28
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

Upload: wei-shan-ang

Post on 14-Jan-2017

320 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: PUGS Meetup Presentation - 11062015

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

Page 2: PUGS Meetup Presentation - 11062015

Topics

1. About Me

2. Differences between Oracle & PostgreSQL

3. Personal experience with PostgreSQL

Page 3: PUGS Meetup Presentation - 11062015

Topics

1. `whoami`

2. Difference between Oracle & PostgreSQL

3. Personal experience with PostgreSQL

Page 4: PUGS Meetup Presentation - 11062015

`whoami`

● Ang Wei Shan● Database Administrator● 3 years in Oracle● 1 year in SQL Server & DB2● <2 months in PostgreSQL● GMO GlobalSign

Page 5: PUGS Meetup Presentation - 11062015

Topics

1. About Me

2. Differences between Oracle & PostgreSQL

3. Personal experience with PostgreSQL

Page 6: PUGS Meetup Presentation - 11062015

Introduction

All comparisons are done using Oracle Database 11gR2 and PostgreSQL 9.3

Page 7: PUGS Meetup Presentation - 11062015

● Relational*● ACID compliant● Proprietary Licensing● 35 years of active development● “Owned” by a man who has an island

Oracle

Page 8: PUGS Meetup Presentation - 11062015

● Relational*● ACID compliant● Open-Source● 25 years of active development● Runs by core team of 6 from different

companies

PostgreSQL

Page 9: PUGS Meetup Presentation - 11062015

Basic Concepts

Page 10: PUGS Meetup Presentation - 11062015

● 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

Page 11: PUGS Meetup Presentation - 11062015

How does Oracle comply with ACID

● Atomicity

● Consistency

● Isolation

● Durability

Page 12: PUGS Meetup Presentation - 11062015

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

Page 13: PUGS Meetup Presentation - 11062015

● 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

Page 14: PUGS Meetup Presentation - 11062015

● Atomicity

● Consistency

● Isolation

● Durability

How does PostgreSQL comply with ACID

Page 15: PUGS Meetup Presentation - 11062015

● 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

Page 16: PUGS Meetup Presentation - 11062015

Basic Architecture

Page 17: PUGS Meetup Presentation - 11062015

Oracle

Page 18: PUGS Meetup Presentation - 11062015
Page 19: PUGS Meetup Presentation - 11062015

PostgreSQL

Page 20: PUGS Meetup Presentation - 11062015
Page 21: PUGS Meetup Presentation - 11062015

Topics

1. About Me

2. Differences between Oracle & PostgreSQL

3. Personal experience with PostgreSQL

Page 22: PUGS Meetup Presentation - 11062015

● 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! :)

Page 23: PUGS Meetup Presentation - 11062015

● 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 :(

Page 24: PUGS Meetup Presentation - 11062015

Overall Thoughts

Page 25: PUGS Meetup Presentation - 11062015

Require much more experienced people to manage open-source than proprietary technology. There are many different ways of doing the same thing.

Page 26: PUGS Meetup Presentation - 11062015

Oracle definitely beats PostgreSQL in terms of technology…. But are you willing to pay USD >45k per core license?

Page 27: PUGS Meetup Presentation - 11062015

I would prefer to use it for free, find solutions and work around the limitations. That is, after all, the job of an engineer.

Page 28: PUGS Meetup Presentation - 11062015

Thank [email protected]

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