SlideShare una empresa de Scribd logo
1 de 52
Introduction to 
PostgreSQL 
November, 2014 
Creative Commons Attribution License
Who Are We? 
● Jim Mlodgenski 
– jimm@openscg.com 
– @jim_mlodgenski 
● Co-organizer of 
– NYCPUG - www.nycpug.org 
● Director, PgUS 
– www.postgresql.us 
● CTO, OpenSCG 
– www.openscg.com 
● Jonathan S. Katz 
– jonathan@venuebook.com 
– @jkatz05 
● Co-organizer of 
– NYCPUG - www.nycpug.org 
● Director, PgUS 
– www.postgresql.us 
● CTO, VenueBook 
– www.venuebook.com
History 
● The world’s most advanced open source database 
● Designed for extensibility and customization 
● ANSI/ISO compliant SQL support 
● Actively developed for almost 30 years 
– University POSTGRES (1986-1993) 
– Postgres95 (1994-1995) 
– PostgreSQL (1996-2014)
Timeline 
“Over the past few years, 
PostgreSQL has become the 
preferred open source 
relational database for many 
enterprise developers and 
start-ups, powering leading 
geospatial and mobile 
applications.” 
– Jeff Barr, Chief Evangelist, 
Amazon Web Services
Why PostgreSQL 
Affordability 
Technology 
Security 
Flexibility 
Stability 
Extensibility 
Reliability 
Predictability 
Community 
Auditability
Technology 
● Full Featured Database 
– Mature Server Side Programming Functionality 
– Hot Standby High Availability 
– Online Backups 
– Point In Time Recovery 
– Table Partitioning 
– Spatial Functionality 
– Full Text Search
Security 
● Object Level Privileges assigned to “Roles & User” 
● Row Level Security 
● Many Authentication mechanisms 
– Kerberos 
– LDAP 
– PAM 
– GSSAPI 
● Native SSL Support. 
● Data Level Encryption (AES, 3DES, etc) 
● Ability to utilize 3rd party Key Stores in a full PKI 
infrastructure
Flexibility 
● No Vendor Lock-in 
– Compliant with the ANSI SQL standard 
– Runs on all major platforms using all major languages and middleware 
● “BSD-like” license – PostgreSQL License 
– Allows businesses to retain the option of commercializing the final product 
with minimal legal issues 
– No fear of “Open Source Viral Infection”
Predictability 
● Predictable release cycles 
– The average span between major 
releases over the last 10 years is 13 
months 
● Quick turn around on patches 
– The average span between minor 
releases over the last 5 years is 3 
months 
Version Release Date 
7.3 Nov-02 
7.4 Nov-03 
8.0 Jan-05 
8.1 Nov-05 
8.2 Dec-06 
8.3 Feb-08 
8.4 Jul-09 
9.0 Aug-10 
9.1 Sep-11 
9.2 Sep-12 
9.3 Sep-13
Community 
● Strong Open Source Community 
● Independent & Thriving Development Community 
– 10+ committers and ~200 reviewers 
– 1,500 contributors and 10,000+ members 
● Millions of downloads per year 
● PostgreSQL is a meritocracy 
– Influence through their merits (usually technical) of the contributor
Who's Using PostgreSQL
PostgreSQL Success Stories 
“…With PostgreSQL we have been successful in growing the databases as the company 
has grown, both in number of users and in the complexity of services we offer…” 
Hannu Krosing – Database Architect Skye Technologies. 
“We manage multiple terabytes of data in more than 50 unique production PostgreSQL 
databases.” 
Cisco uses PostgreSQL as the embedded database in all its “Case Sensitive Routing” 
(CSR) products to store carrier details, rules, contacts, routes – to perform call routing. 
“…Fujitsu is proud of its sponsorship of contributions to PostgreSQL and of its work with 
The PostgreSQL community. We are committed to helping make PostgreSQL the leading 
Database Management System…” 
Takayuki Nakazawa – Director Database in Software Group.
Database 101 
● A database stores data 
● Clients ( people or applications ) input data into tables 
( relations ) in the database and retrieve data from it 
● Relational Database Management Systems are responsible 
for managing the safe-storage of data 
● RDBMSs are designed to store data in an A.C.I.D compliant 
way ( all or nothing ) 
– This is done via transactions
Database 101 - (ACID) 
● Atomic 
– Store data in an 'all-or-nothing' approach 
● Consistent 
– Give me a consistent picture of the data 
● Isolated 
– Prevent concurrent data access from causing me woe 
● Durable 
– When I say 'COMMIT;' the data, make sure it is safe until I explicitly destroy it
Database 101 - (Transactions) 
● All or nothing 
● A transaction has 
– A Beginning ( BEGIN; ) 
– Work ( multiple lines of SQL, i.e. INSERT / UPDATE / DELETE) 
– An Ending ( END; ) You would expect one of two cases 
● COMMIT; ( save everything ) 
● ROLLBACK; ( undo all changes, save nothing) 
– Once the transaction has ended, it will either make ALL of the changes 
between BEGIN; and COMMIT; or NONE of them ( if there is an error for 
example )
PostgreSQL 101 
● PostgreSQL meets all of the requirements to be a fully 
ACID-compliant, transactional database. 
● PostgreSQL RDBMS serves a cluster aka an instance. 
– An instance serves one ( and only one ) TCP/IP port 
– Contains at least one database 
– Has an associated data-directory
Major Features 
● Full network client-server architecture 
● ACID compliant 
● Transactional ( uses WAL / REDO ) 
● Partitioning 
● Tiered storage via tablespaces 
● Multiversion Concurrency Control 
( readers don't block writers ) 
● On-line maintenance operations 
● Hot ( readonly ) and Warm ( quick-promote 
) standby 
● Log-based and trigger based replication 
● SSL 
● Full-text search 
● Procedural languages 
– Pl/pgSQL plus other, custom languages
General Limitations 
Limit Value 
Maximum Database Size Unlimited 
Maximum Table Size 32 TB 
Maximum Row Size 1.6 TB 
Maximum Field Size 1 GB 
Maximum Rows / Table Unlimited 
Maximum Columns / Table 250-1600 
Maximum Indexes / Table Unlimited
Client Architecture
Server Overview 
● PostgreSQL utilizes a multi-process architecture 
● Similar to Oracle's 'Dedicated Server' mode 
● Types of processes 
– Primary ( postmaster ) 
– Per-connection backend process 
– Utility ( maintenance processes )
Server Architecture
Process Components
Memory Components
On-Disk Components
Data Types 
● Building blocks of a schema 
● Optimized on-disk format for a specific type of data 
● PostgreSQL provides: 
– Wide array (no pun intended) of basic to complex data types 
– Functional interfaces for ease of manipulation 
– Ability to extend and create custom data types
Number Types 
Name Storage Size Range 
smallint 2 bytes -32768 to +32767 
integer 4 bytes -2147483648 to +2147483647 
bigint 8 bytes -9223372036854775808 to 9223372036854775807 
decimal variable up to 131072 digits before the decimal point; up to 
16383 digits after the decimal point 
numeric variable up to 131072 digits before the decimal point; up to 
16383 digits after the decimal point 
real 4 bytes 6 decimal digits precision 
double 8 bytes 15 decimal digits precision
Character Types 
Name Description 
varchar(n) variable-length with limit 
char(n) fixed-length, blank padded 
text variable unlimited length
Date/Time Types 
Name Size Range Resolution 
timestamp 
without 
timezone 
8 bytes 4713 BC to 294276 AD 1 microsecond / 14 digits 
timestamp with 
timezone 
8 bytes 4713 BC to 294276 AD 1 microsecond / 14 digits 
date 4 bytes 4713 BC to 5874897 AD 1 day 
time without 
timezone 
8 bytes 00:00:00 to 24:00:00 1 microsecond / 14 digits 
time with 
timezone 
12 bytes 00:00:00+1459 to 
24:00:00-1459 
1 microsecond / 14 digits 
interval 12 bytes -178000000 years to 
178000000 years 
1 microsecond / 14 digits
Specialized Types 
Name Storage Size Range 
boolean 1 byte false to true 
smallserial 2 bytes 1 to 32767 
serial 4 bytes 1 to 2147483647 
bigserial 8 bytes 1 to 9223372036854775807 
bytea 1 to 4 bytes plus size of 
binary string 
variable-length binary string 
cidr 7 or 19 bytes IPv4 or IPv6 networks 
inet 7 or 19 bytes IPv4 or IPv6 hosts or networks 
macaddr 6 bytes MAC addresses 
uuid 16 bytes Universally Unique Identifiers
“Schema-less” Types 
Name Description 
xml stores XML data and checks the input values for well-formedness 
hstore stores sets of key/value pairs 
json stores an exact copy of the input JSON document 
jsonb stores a decomposed binary format of the input JSON 
document
Range Types 
● Represents a range of an element type 
– Integers 
– Numerics 
– Times 
– Dates 
– And more...
Range Types 
CREATE TABLE travel_log ( 
id serial PRIMARY KEY, 
name varchar(255), 
travel_range daterange, 
EXCLUDE USING gist (travel_range WITH &&) 
); 
INSERT INTO travel_log (name, trip_range) VALUES ('Chicago', daterange('2012-03-12', '2012-03-17')); 
INSERT INTO travel_log (name, trip_range) VALUES ('Austin', daterange('2012-03-16', '2012-03-18')); 
ERROR: conflicting key value violates exclusion constraint "travel_log_trip_range_excl" 
DETAIL: Key (trip_range)=([2012-03-16,2012-03-18)) conflicts with existing key (trip_range)=([2012-03- 
12,2012-03-17)).
Indexes 
● Enhances database 
performance 
● Enforces some types of 
constraints 
– Uniqueness 
– Exclusion
Index Types 
● B-Tree 
● Generalized Inverted Index (GIN) 
● Generalized Search Tree (GIST) 
● Space-Partitoned Generalized Search Tree (SP-GIST) 
Coming Soon... 
● Block Range Index (BRIN) 
● “VODKA”
Procedural Languages 
● Allows for use defined functionality to be run within the 
database 
– Used as functions or triggers 
● Frequent use cases 
– Enhance performance 
– Increase security 
– Centralize business logic
Procedural Language Types 
● PL/pgSQL 
● PL/Perl 
● PL/TCL 
● PL/Python 
● More available through extensions...
Extensions 
● Additional modules that can be plugged into PostgreSQL 
● Can be used to add a ton of useful features 
– Procedural Languages 
– Data Types 
– Administration Tools 
– Foreign Data Wrappers 
● Many found in contrib 
● Also www.pgxn.org
Procedural Language Extensions 
● pl/Java 
● pl/v8 
● pl/R 
● pl/Ruby 
● pl/schema 
● pl/lolcode 
● pl/sh 
● pl/Proxy 
● pl/psm 
● pl/lua 
● pl/php
Data Type Extensions 
● Hstore 
● Case Insensitive Text (citext) 
● International Product Numbering Standards (ISN) 
● PostGIS (geometry) 
● BioPostgres 
● SSN 
● Email
PostGIS 
● PostGIS adds OpenGIS Consortium 
(OGC) compliant geometry data types 
and functions to PostgreSQL 
● With PostgreSQL, becomes a best of 
breed spatial and raster database
Administration Tool Extensions 
● auto_explain 
● pageinspect 
● pg_buffercache 
● pg_stat_statements 
● Slony 
● OmniPITR 
● pg_monitoring 
● pgaudit 
● pg_partman
What are Foreign Data Wrappers? 
● Used with SQL/MED 
– New ANIS SQL 2003 Extension 
– Management of External Data 
– Standard way of handling remote objects in SQL databases 
● Wrappers used by SQL/MED to access remotes data 
sources 
● Makes external data sources look like a PostgreSQL table
FDW Extensions 
● PostgreSQL 
● Oracle 
● MySQL 
● Informix 
● Firebird 
● SQLite 
● JDBC 
● ODBC 
● TDS (Sybase/SQL Server) 
● S3 
● WWW 
● PG-Strom 
● Column Store 
● Delimited files 
● Fixed length files 
● JSON files 
● Hadoop 
● MongoDB 
● CouchDB 
● MonetDB 
● Redis 
● Neo4j 
● Tycoon 
● LDAP
MongoDB FDW 
CREATE SERVER mongo_server FOREIGN DATA WRAPPER 
mongo_fdw OPTIONS (address '192.168.122.47', port '27017'); 
CREATE FOREIGN TABLE databases ( 
_id NAME, 
name TEXT 
) 
SERVER mongo_server 
OPTIONS (database 'mydb', collection 'pgData'); 
test=# select * from databases ; 
_id | name 
--------------------------+------------ 
52fd49bfba3ae4ea54afc459 | mongo 
52fd49bfba3ae4ea54afc45a | postgresql 
52fd49bfba3ae4ea54afc45b | oracle 
52fd49bfba3ae4ea54afc45c | mysql 
52fd49bfba3ae4ea54afc45d | redis 
52fd49bfba3ae4ea54afc45e | db2 
(6 rows)
WWW FDW 
test=# SELECT * FROM www_fdw_geocoder_google 
test-# WHERE address = '731 Lexington Ave, New York, NY'; 
-[ RECORD 1 ]-----+---------------------------------------------- 
address | 
type | street_address 
formatted_address | 731 Lexington Avenue, New York, NY 10022, USA 
lat | 40.7619363 
lng | -73.9681017 
location_type | ROOFTOP
PL/Proxy 
● Developed by 
Skype 
● Allows for 
scalability and 
parallelization 
● Uses procedural 
languages and 
FDWs
PostgreSQL Replication 
● Replicate to read-only 
databases using native 
streaming replication 
● All writes go to a master 
server 
● Load balance across the 
pool of servers
PostgreSQL Scalability 
● PostgreSQL scales 
up linearly up to 64 
cores 
● May scale further 
but hardware is not 
available to the 
community 
http://rhaas.blogspot.com/2012/04/did-i-say-32-cores-how-about-64.html
Getting Help 
● Community Mail List 
– http://www.postgresql.org/list/ 
● IRC 
– irc://irc.freenode.net/postgresql 
● NYC PostgreSQL User Group 
– http://www.nycpug.org
Questions?

Más contenido relacionado

La actualidad más candente

Postgresql Database Administration- Day3
Postgresql Database Administration- Day3Postgresql Database Administration- Day3
Postgresql Database Administration- Day3PoguttuezhiniVP
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PGConf APAC
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres MonitoringDenish Patel
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsCommand Prompt., Inc
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1Federico Campoli
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and OptimizationPgDay.Seoul
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLJim Mlodgenski
 
PostgreSQL Security. How Do We Think?
PostgreSQL Security. How Do We Think?PostgreSQL Security. How Do We Think?
PostgreSQL Security. How Do We Think?Ohyama Masanori
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep InternalEXEM
 
Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15Jonathan Katz
 
Working with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDBWorking with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDBScaleGrid.io
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performancePostgreSQL-Consulting
 
Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1PgTraining
 

La actualidad más candente (20)

Postgresql tutorial
Postgresql tutorialPostgresql tutorial
Postgresql tutorial
 
Postgresql Database Administration- Day3
Postgresql Database Administration- Day3Postgresql Database Administration- Day3
Postgresql Database Administration- Day3
 
PostgreSQL
PostgreSQL PostgreSQL
PostgreSQL
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
 
Get to know PostgreSQL!
Get to know PostgreSQL!Get to know PostgreSQL!
Get to know PostgreSQL!
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
 
PostgreSQL Security. How Do We Think?
PostgreSQL Security. How Do We Think?PostgreSQL Security. How Do We Think?
PostgreSQL Security. How Do We Think?
 
Backup and-recovery2
Backup and-recovery2Backup and-recovery2
Backup and-recovery2
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep Internal
 
Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15
 
Working with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDBWorking with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDB
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1
 

Destacado

Beginner’s Guide to Windows Installer XML (WiX)
Beginner’s Guide to Windows Installer XML (WiX)Beginner’s Guide to Windows Installer XML (WiX)
Beginner’s Guide to Windows Installer XML (WiX)Alek Davis
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Peter R. Egli
 
OPEN SOURCE SEMINAR PRESENTATION
OPEN SOURCE SEMINAR PRESENTATIONOPEN SOURCE SEMINAR PRESENTATION
OPEN SOURCE SEMINAR PRESENTATIONRitwick Halder
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slidesSmithss25
 

Destacado (7)

SNMP/SMTP/MIME
SNMP/SMTP/MIMESNMP/SMTP/MIME
SNMP/SMTP/MIME
 
Beginner’s Guide to Windows Installer XML (WiX)
Beginner’s Guide to Windows Installer XML (WiX)Beginner’s Guide to Windows Installer XML (WiX)
Beginner’s Guide to Windows Installer XML (WiX)
 
PostgreSQL and MySQL
PostgreSQL and MySQLPostgreSQL and MySQL
PostgreSQL and MySQL
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
OPEN SOURCE SEMINAR PRESENTATION
OPEN SOURCE SEMINAR PRESENTATIONOPEN SOURCE SEMINAR PRESENTATION
OPEN SOURCE SEMINAR PRESENTATION
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
 

Similar a Introduction to PostgreSQL

Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartMukesh Singh
 
No sql bigdata and postgresql
No sql bigdata and postgresqlNo sql bigdata and postgresql
No sql bigdata and postgresqlZaid Shabbir
 
IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...
IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...
IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...Marcin Bielak
 
PostgreSQL as an Alternative to MSSQL
PostgreSQL as an Alternative to MSSQLPostgreSQL as an Alternative to MSSQL
PostgreSQL as an Alternative to MSSQLAlexei Krasner
 
Introduction to Postrges-XC
Introduction to Postrges-XCIntroduction to Postrges-XC
Introduction to Postrges-XCAshutosh Bapat
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabaseMubashar Iqbal
 
NoSQL Solutions - a comparative study
NoSQL Solutions - a comparative studyNoSQL Solutions - a comparative study
NoSQL Solutions - a comparative studyGuillaume Lefranc
 
PASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep DivePASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep DiveTravis Wright
 
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018Holden Karau
 
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...Ashnikbiz
 
Argus Production Monitoring at Salesforce
Argus Production Monitoring at SalesforceArgus Production Monitoring at Salesforce
Argus Production Monitoring at SalesforceHBaseCon
 
Argus Production Monitoring at Salesforce
Argus Production Monitoring at Salesforce Argus Production Monitoring at Salesforce
Argus Production Monitoring at Salesforce HBaseCon
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...javier ramirez
 
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...Hernan Costante
 
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...NETWAYS
 
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...Command Prompt., Inc
 
SQL or NoSQL - how to choose
SQL or NoSQL - how to chooseSQL or NoSQL - how to choose
SQL or NoSQL - how to chooseLars Thorup
 
Cassandra 2012
Cassandra 2012Cassandra 2012
Cassandra 2012beobal
 

Similar a Introduction to PostgreSQL (20)

Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
No sql bigdata and postgresql
No sql bigdata and postgresqlNo sql bigdata and postgresql
No sql bigdata and postgresql
 
IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...
IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...
IoT databases - review and challenges - IoT, Hardware & Robotics meetup - onl...
 
PostgreSQL as an Alternative to MSSQL
PostgreSQL as an Alternative to MSSQLPostgreSQL as an Alternative to MSSQL
PostgreSQL as an Alternative to MSSQL
 
Introduction to Postrges-XC
Introduction to Postrges-XCIntroduction to Postrges-XC
Introduction to Postrges-XC
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
 
NoSQL Solutions - a comparative study
NoSQL Solutions - a comparative studyNoSQL Solutions - a comparative study
NoSQL Solutions - a comparative study
 
Introduction to azure document db
Introduction to azure document dbIntroduction to azure document db
Introduction to azure document db
 
PASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep DivePASS Summit - SQL Server 2017 Deep Dive
PASS Summit - SQL Server 2017 Deep Dive
 
AmazonRedshift
AmazonRedshiftAmazonRedshift
AmazonRedshift
 
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
 
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
 
Argus Production Monitoring at Salesforce
Argus Production Monitoring at SalesforceArgus Production Monitoring at Salesforce
Argus Production Monitoring at Salesforce
 
Argus Production Monitoring at Salesforce
Argus Production Monitoring at Salesforce Argus Production Monitoring at Salesforce
Argus Production Monitoring at Salesforce
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
 
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
 
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
OSMC 2018 | Learnings, patterns and Uber’s metrics platform M3, open sourced ...
 
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
 
SQL or NoSQL - how to choose
SQL or NoSQL - how to chooseSQL or NoSQL - how to choose
SQL or NoSQL - how to choose
 
Cassandra 2012
Cassandra 2012Cassandra 2012
Cassandra 2012
 

Más de Jim Mlodgenski

Oracle postgre sql-mirgration-top-10-mistakes
Oracle postgre sql-mirgration-top-10-mistakesOracle postgre sql-mirgration-top-10-mistakes
Oracle postgre sql-mirgration-top-10-mistakesJim Mlodgenski
 
Debugging Your PL/pgSQL Code
Debugging Your PL/pgSQL CodeDebugging Your PL/pgSQL Code
Debugging Your PL/pgSQL CodeJim Mlodgenski
 
An Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersAn Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersJim Mlodgenski
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasJim Mlodgenski
 
Leveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentLeveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentJim Mlodgenski
 
Scaling PostreSQL with Stado
Scaling PostreSQL with StadoScaling PostreSQL with Stado
Scaling PostreSQL with StadoJim Mlodgenski
 
Multi-Master Replication with Slony
Multi-Master Replication with SlonyMulti-Master Replication with Slony
Multi-Master Replication with SlonyJim Mlodgenski
 
Scaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLScaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLJim Mlodgenski
 

Más de Jim Mlodgenski (11)

Strategic autovacuum
Strategic autovacuumStrategic autovacuum
Strategic autovacuum
 
Oracle postgre sql-mirgration-top-10-mistakes
Oracle postgre sql-mirgration-top-10-mistakesOracle postgre sql-mirgration-top-10-mistakes
Oracle postgre sql-mirgration-top-10-mistakes
 
Profiling PL/pgSQL
Profiling PL/pgSQLProfiling PL/pgSQL
Profiling PL/pgSQL
 
Debugging Your PL/pgSQL Code
Debugging Your PL/pgSQL CodeDebugging Your PL/pgSQL Code
Debugging Your PL/pgSQL Code
 
An Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersAn Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL Triggers
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
 
Postgresql Federation
Postgresql FederationPostgresql Federation
Postgresql Federation
 
Leveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentLeveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL Environment
 
Scaling PostreSQL with Stado
Scaling PostreSQL with StadoScaling PostreSQL with Stado
Scaling PostreSQL with Stado
 
Multi-Master Replication with Slony
Multi-Master Replication with SlonyMulti-Master Replication with Slony
Multi-Master Replication with Slony
 
Scaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLScaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQL
 

Último

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Introduction to PostgreSQL

  • 1. Introduction to PostgreSQL November, 2014 Creative Commons Attribution License
  • 2. Who Are We? ● Jim Mlodgenski – jimm@openscg.com – @jim_mlodgenski ● Co-organizer of – NYCPUG - www.nycpug.org ● Director, PgUS – www.postgresql.us ● CTO, OpenSCG – www.openscg.com ● Jonathan S. Katz – jonathan@venuebook.com – @jkatz05 ● Co-organizer of – NYCPUG - www.nycpug.org ● Director, PgUS – www.postgresql.us ● CTO, VenueBook – www.venuebook.com
  • 3.
  • 4. History ● The world’s most advanced open source database ● Designed for extensibility and customization ● ANSI/ISO compliant SQL support ● Actively developed for almost 30 years – University POSTGRES (1986-1993) – Postgres95 (1994-1995) – PostgreSQL (1996-2014)
  • 5. Timeline “Over the past few years, PostgreSQL has become the preferred open source relational database for many enterprise developers and start-ups, powering leading geospatial and mobile applications.” – Jeff Barr, Chief Evangelist, Amazon Web Services
  • 6. Why PostgreSQL Affordability Technology Security Flexibility Stability Extensibility Reliability Predictability Community Auditability
  • 7. Technology ● Full Featured Database – Mature Server Side Programming Functionality – Hot Standby High Availability – Online Backups – Point In Time Recovery – Table Partitioning – Spatial Functionality – Full Text Search
  • 8. Security ● Object Level Privileges assigned to “Roles & User” ● Row Level Security ● Many Authentication mechanisms – Kerberos – LDAP – PAM – GSSAPI ● Native SSL Support. ● Data Level Encryption (AES, 3DES, etc) ● Ability to utilize 3rd party Key Stores in a full PKI infrastructure
  • 9. Flexibility ● No Vendor Lock-in – Compliant with the ANSI SQL standard – Runs on all major platforms using all major languages and middleware ● “BSD-like” license – PostgreSQL License – Allows businesses to retain the option of commercializing the final product with minimal legal issues – No fear of “Open Source Viral Infection”
  • 10. Predictability ● Predictable release cycles – The average span between major releases over the last 10 years is 13 months ● Quick turn around on patches – The average span between minor releases over the last 5 years is 3 months Version Release Date 7.3 Nov-02 7.4 Nov-03 8.0 Jan-05 8.1 Nov-05 8.2 Dec-06 8.3 Feb-08 8.4 Jul-09 9.0 Aug-10 9.1 Sep-11 9.2 Sep-12 9.3 Sep-13
  • 11. Community ● Strong Open Source Community ● Independent & Thriving Development Community – 10+ committers and ~200 reviewers – 1,500 contributors and 10,000+ members ● Millions of downloads per year ● PostgreSQL is a meritocracy – Influence through their merits (usually technical) of the contributor
  • 13. PostgreSQL Success Stories “…With PostgreSQL we have been successful in growing the databases as the company has grown, both in number of users and in the complexity of services we offer…” Hannu Krosing – Database Architect Skye Technologies. “We manage multiple terabytes of data in more than 50 unique production PostgreSQL databases.” Cisco uses PostgreSQL as the embedded database in all its “Case Sensitive Routing” (CSR) products to store carrier details, rules, contacts, routes – to perform call routing. “…Fujitsu is proud of its sponsorship of contributions to PostgreSQL and of its work with The PostgreSQL community. We are committed to helping make PostgreSQL the leading Database Management System…” Takayuki Nakazawa – Director Database in Software Group.
  • 14. Database 101 ● A database stores data ● Clients ( people or applications ) input data into tables ( relations ) in the database and retrieve data from it ● Relational Database Management Systems are responsible for managing the safe-storage of data ● RDBMSs are designed to store data in an A.C.I.D compliant way ( all or nothing ) – This is done via transactions
  • 15. Database 101 - (ACID) ● Atomic – Store data in an 'all-or-nothing' approach ● Consistent – Give me a consistent picture of the data ● Isolated – Prevent concurrent data access from causing me woe ● Durable – When I say 'COMMIT;' the data, make sure it is safe until I explicitly destroy it
  • 16. Database 101 - (Transactions) ● All or nothing ● A transaction has – A Beginning ( BEGIN; ) – Work ( multiple lines of SQL, i.e. INSERT / UPDATE / DELETE) – An Ending ( END; ) You would expect one of two cases ● COMMIT; ( save everything ) ● ROLLBACK; ( undo all changes, save nothing) – Once the transaction has ended, it will either make ALL of the changes between BEGIN; and COMMIT; or NONE of them ( if there is an error for example )
  • 17. PostgreSQL 101 ● PostgreSQL meets all of the requirements to be a fully ACID-compliant, transactional database. ● PostgreSQL RDBMS serves a cluster aka an instance. – An instance serves one ( and only one ) TCP/IP port – Contains at least one database – Has an associated data-directory
  • 18. Major Features ● Full network client-server architecture ● ACID compliant ● Transactional ( uses WAL / REDO ) ● Partitioning ● Tiered storage via tablespaces ● Multiversion Concurrency Control ( readers don't block writers ) ● On-line maintenance operations ● Hot ( readonly ) and Warm ( quick-promote ) standby ● Log-based and trigger based replication ● SSL ● Full-text search ● Procedural languages – Pl/pgSQL plus other, custom languages
  • 19. General Limitations Limit Value Maximum Database Size Unlimited Maximum Table Size 32 TB Maximum Row Size 1.6 TB Maximum Field Size 1 GB Maximum Rows / Table Unlimited Maximum Columns / Table 250-1600 Maximum Indexes / Table Unlimited
  • 21. Server Overview ● PostgreSQL utilizes a multi-process architecture ● Similar to Oracle's 'Dedicated Server' mode ● Types of processes – Primary ( postmaster ) – Per-connection backend process – Utility ( maintenance processes )
  • 26. Data Types ● Building blocks of a schema ● Optimized on-disk format for a specific type of data ● PostgreSQL provides: – Wide array (no pun intended) of basic to complex data types – Functional interfaces for ease of manipulation – Ability to extend and create custom data types
  • 27. Number Types Name Storage Size Range smallint 2 bytes -32768 to +32767 integer 4 bytes -2147483648 to +2147483647 bigint 8 bytes -9223372036854775808 to 9223372036854775807 decimal variable up to 131072 digits before the decimal point; up to 16383 digits after the decimal point numeric variable up to 131072 digits before the decimal point; up to 16383 digits after the decimal point real 4 bytes 6 decimal digits precision double 8 bytes 15 decimal digits precision
  • 28. Character Types Name Description varchar(n) variable-length with limit char(n) fixed-length, blank padded text variable unlimited length
  • 29. Date/Time Types Name Size Range Resolution timestamp without timezone 8 bytes 4713 BC to 294276 AD 1 microsecond / 14 digits timestamp with timezone 8 bytes 4713 BC to 294276 AD 1 microsecond / 14 digits date 4 bytes 4713 BC to 5874897 AD 1 day time without timezone 8 bytes 00:00:00 to 24:00:00 1 microsecond / 14 digits time with timezone 12 bytes 00:00:00+1459 to 24:00:00-1459 1 microsecond / 14 digits interval 12 bytes -178000000 years to 178000000 years 1 microsecond / 14 digits
  • 30. Specialized Types Name Storage Size Range boolean 1 byte false to true smallserial 2 bytes 1 to 32767 serial 4 bytes 1 to 2147483647 bigserial 8 bytes 1 to 9223372036854775807 bytea 1 to 4 bytes plus size of binary string variable-length binary string cidr 7 or 19 bytes IPv4 or IPv6 networks inet 7 or 19 bytes IPv4 or IPv6 hosts or networks macaddr 6 bytes MAC addresses uuid 16 bytes Universally Unique Identifiers
  • 31. “Schema-less” Types Name Description xml stores XML data and checks the input values for well-formedness hstore stores sets of key/value pairs json stores an exact copy of the input JSON document jsonb stores a decomposed binary format of the input JSON document
  • 32. Range Types ● Represents a range of an element type – Integers – Numerics – Times – Dates – And more...
  • 33. Range Types CREATE TABLE travel_log ( id serial PRIMARY KEY, name varchar(255), travel_range daterange, EXCLUDE USING gist (travel_range WITH &&) ); INSERT INTO travel_log (name, trip_range) VALUES ('Chicago', daterange('2012-03-12', '2012-03-17')); INSERT INTO travel_log (name, trip_range) VALUES ('Austin', daterange('2012-03-16', '2012-03-18')); ERROR: conflicting key value violates exclusion constraint "travel_log_trip_range_excl" DETAIL: Key (trip_range)=([2012-03-16,2012-03-18)) conflicts with existing key (trip_range)=([2012-03- 12,2012-03-17)).
  • 34. Indexes ● Enhances database performance ● Enforces some types of constraints – Uniqueness – Exclusion
  • 35. Index Types ● B-Tree ● Generalized Inverted Index (GIN) ● Generalized Search Tree (GIST) ● Space-Partitoned Generalized Search Tree (SP-GIST) Coming Soon... ● Block Range Index (BRIN) ● “VODKA”
  • 36. Procedural Languages ● Allows for use defined functionality to be run within the database – Used as functions or triggers ● Frequent use cases – Enhance performance – Increase security – Centralize business logic
  • 37. Procedural Language Types ● PL/pgSQL ● PL/Perl ● PL/TCL ● PL/Python ● More available through extensions...
  • 38. Extensions ● Additional modules that can be plugged into PostgreSQL ● Can be used to add a ton of useful features – Procedural Languages – Data Types – Administration Tools – Foreign Data Wrappers ● Many found in contrib ● Also www.pgxn.org
  • 39. Procedural Language Extensions ● pl/Java ● pl/v8 ● pl/R ● pl/Ruby ● pl/schema ● pl/lolcode ● pl/sh ● pl/Proxy ● pl/psm ● pl/lua ● pl/php
  • 40. Data Type Extensions ● Hstore ● Case Insensitive Text (citext) ● International Product Numbering Standards (ISN) ● PostGIS (geometry) ● BioPostgres ● SSN ● Email
  • 41. PostGIS ● PostGIS adds OpenGIS Consortium (OGC) compliant geometry data types and functions to PostgreSQL ● With PostgreSQL, becomes a best of breed spatial and raster database
  • 42. Administration Tool Extensions ● auto_explain ● pageinspect ● pg_buffercache ● pg_stat_statements ● Slony ● OmniPITR ● pg_monitoring ● pgaudit ● pg_partman
  • 43. What are Foreign Data Wrappers? ● Used with SQL/MED – New ANIS SQL 2003 Extension – Management of External Data – Standard way of handling remote objects in SQL databases ● Wrappers used by SQL/MED to access remotes data sources ● Makes external data sources look like a PostgreSQL table
  • 44. FDW Extensions ● PostgreSQL ● Oracle ● MySQL ● Informix ● Firebird ● SQLite ● JDBC ● ODBC ● TDS (Sybase/SQL Server) ● S3 ● WWW ● PG-Strom ● Column Store ● Delimited files ● Fixed length files ● JSON files ● Hadoop ● MongoDB ● CouchDB ● MonetDB ● Redis ● Neo4j ● Tycoon ● LDAP
  • 45. MongoDB FDW CREATE SERVER mongo_server FOREIGN DATA WRAPPER mongo_fdw OPTIONS (address '192.168.122.47', port '27017'); CREATE FOREIGN TABLE databases ( _id NAME, name TEXT ) SERVER mongo_server OPTIONS (database 'mydb', collection 'pgData'); test=# select * from databases ; _id | name --------------------------+------------ 52fd49bfba3ae4ea54afc459 | mongo 52fd49bfba3ae4ea54afc45a | postgresql 52fd49bfba3ae4ea54afc45b | oracle 52fd49bfba3ae4ea54afc45c | mysql 52fd49bfba3ae4ea54afc45d | redis 52fd49bfba3ae4ea54afc45e | db2 (6 rows)
  • 46. WWW FDW test=# SELECT * FROM www_fdw_geocoder_google test-# WHERE address = '731 Lexington Ave, New York, NY'; -[ RECORD 1 ]-----+---------------------------------------------- address | type | street_address formatted_address | 731 Lexington Avenue, New York, NY 10022, USA lat | 40.7619363 lng | -73.9681017 location_type | ROOFTOP
  • 47. PL/Proxy ● Developed by Skype ● Allows for scalability and parallelization ● Uses procedural languages and FDWs
  • 48. PostgreSQL Replication ● Replicate to read-only databases using native streaming replication ● All writes go to a master server ● Load balance across the pool of servers
  • 49. PostgreSQL Scalability ● PostgreSQL scales up linearly up to 64 cores ● May scale further but hardware is not available to the community http://rhaas.blogspot.com/2012/04/did-i-say-32-cores-how-about-64.html
  • 50. Getting Help ● Community Mail List – http://www.postgresql.org/list/ ● IRC – irc://irc.freenode.net/postgresql ● NYC PostgreSQL User Group – http://www.nycpug.org
  • 51.