SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
An Evening with PostgreSQL 
Command Prompt, Inc.
Who Am I 
● @linuxhiker 
● +JoshuaDrakeLinuxHiker 
● jd@commandprompt.com 
● Lead Consultant – Command Prompt, Inc. 
● Director – Software in the Public Interest 
● President – United States PostgreSQL
Rated: Pg-13 
● I do this for fun. This is not my day job. 
● East Coast from the West Coast 
● Your ego is not my concern 
● To to take offense is to not be comfortable in oneself. 
● Hopefully you laugh and learn
Help control license costs 
If you are selling licenses to software, you are 
not helping control license costs.
Proactive SLA 
● Remote DBA / Sysadmin 
● Proactive Response 
● 4 Hours of DBA (minimum) 
● SLA / 24x7 / 365 
● No Emergency/After Hours rates 
● Flat, discounted rate 
From 1350.00/mo
What are we talking about 
● What is PostgreSQL? 
● Community Structure 
● Comparison to other databases 
● Awesome PostgreSQL stuff + 9.4 features 
● WTH were they thinking! 
● Guaranteed not to be in order
What is PostgreSQL? 
● The oldest of the open source databases (derived from 
University Ingres 1974) 
● The most advanced Open Source (possibly of closed 
too) database 
● A full ACID compliant, relational, object-relational, 
document, modern, scalable database.
Community Structure 
● Everyone Welcome 
● Meritocracy 
● INTL: Postgresql.org 
● Japan: Postgresql.jp 
● EU: Postgresql.eu 
● US: Postgresql.us 
● Smaller ones (Brazil, France, Italy)
Comparison to other databases 
● Licensing 
● Community 
● No single point of failure 
● Feature parity with all databases, more 
advanced than some 
● Best of both worlds, relational or document
Licensing 
BSD not GPL 
● Important for commercial providers
Community 
● Large 
● Vibrant 
● Active 
● All walks of life 
● Driven by the ecosystem, not a company
No single point of failure 
● Can not be bought 
● Can not go out of business 
● Can not be co-opted 
● Many known and qualified support/services 
companies (CMD, PgExperts, OmniTI, 
BullInfoSys, Consistent State, 2nd Quadrant)
Feature Parity 
● We have reached a point of... oh PostgreSQL 
● Like MSSQL, Oracle, Sybase, just another SQL 
database but with neat stuff 
● No longer a fringe product (thanks to Oracle)
Standard Features 
● SQL Compliance 
● Partitioning 
● Replication 
● Tablespaces 
● ACID
AWESOME Stuff 
BEGIN; 
ALTER TABLE foo ADD COLUMN bar text; 
d foo 
COMMIT/ROLLBACK; 
(Mysql can't do this)
Craziness 
BEGIN; 
CREATE TABLE foo (id serial, test text); 
CREATE TABLE bar (a foo); 
insert into bar values (row(1,'this is a test')); 
postgres=# select * from bar; 
a 
---------------------- 
(1,"this is a test") 
– Say what?
It gets better 
postgres=# select (a).id from bar; 
id 
---- 
1
Wooohaa! 
postgres=# select 
row_to_json(row((a).id),true) from bar; 
row_to_json 
------------- 
{"f1":1}
Enough of that, let's talk 9.4 
● JSONB 
● Logical Decoding (Including Logical 
Replication) 
● BDR 
● Wal Bouncer 
● Other 9.4 stuff
JSON 
● Added in 9.2 
● Input is validated 
● Stored as text representation 
– Slower on retrieval due to per row parse (per value?) 
● Preserves key order and duplicates 
● Mature support in 9.3 
– Better Functions 
– Operators 
● Advanced support in 9.4 
– Type building functions 
● About 15% storage overhead 
● Expression only indexes (WHERE foo)
When to use JSON 
● Document storage 
● Duplicate preservation 
● Key order preservation
JSONB 
● 9.4+ 
● Full JSON Implementation 
● Stored as binary (unlike JSON) 
● Works with all JSON operators 
● HSTORE-style query operators 
● No key order 
● No duplicate preservation 
● Faster access 
● GIN Indexing (and expression), for containment ops use json_path_ops 
● About 35% storage overhead 
● Much faster than JSON for retrieval (slower than HSTORE)
JSONB Features 
● Equality operator 
– SELECT '{“a”: 1, “b”: 2}'::jsonb = '{“b”:2, “a”:1}'::jsonb 
● Containment operator (Softserve) 
– SELECT '{“a”: 1, “b”: 2}'::jsonb @> {“b”:2}::jsonb 
● Existence 
– SELECT '{“a”: 1, “b”: 2}'::jsonb ? 'b'; 
● Nested operators (softserve works as well) 
– SELECT '{“a”: [1,2]}'::jsonb = '{“a”:[1,2]}'::jsonb 
● Existence (any) - ?| 
● Existence (all) - ?&
JSON/JSBON thanks 
Information retrieved from PDXPUG day in 
2014 via David Wheeler 
● http://vimeo.com/105491487
Logical Decoding 
PostgreSQL provides infrastructure to stream the modifications 
performed via SQL to external consumers. 
The format in which those changes are streamed is determined by 
the output plugin used. 
Every output plugin has access to each individual new row produced 
by INSERT and the new row version created by UPDATE. Availability 
of old row versions for UPDATE and DELETE depends on the 
configured REPLICA IDENTITY. 
It is also possible to write additional methods of consuming the 
output of a replication slot without modifying core code. 
(http://www.postgresql.org/docs/9.4/static/logicaldecoding.html)
What does Logical Decoding Mean? 
● You now have backend access to 
INSERT/UPDATE/DELETE mechanisms. 
● Is used to implement new features such as: 
– BDR: https://wiki.postgresql.org/wiki/BDR_User_Guide 
– Auditing 
– Walbouncer: 
http://www.cybertec.at/en/products/walbouncer-enterprise-grade- 
partial-replication/
BDR 
● Multi-Master without triggers! (Sorry Bucardo) 
● Uses LLSR (From Logical Decoding) 
● Supports distributed Sequences 
● Supports synchronisation functions 
● Supports conflict handlers 
● Highly performant 
● Eventually consistent 
● Up to 48 nodes
WalBouncer 
● Requires 9.4 
● Allows partial replication to remote replicas 
– Each replica can have a different data set 
● Filters based on WAL 
● Single master to many slave 
● Can be disconcerting to the novice 
● http://www.cybertec.at/postgresql_produkte/walbouncer/
Other 9.4 Stuff 
● GIN indexes now faster and smaller 
● pg_prewarm 
● ALTER SYSTEM 
● Concurrent materialized view refresh 
● Update Views with different columns
ALTER SYSTEM 
● Commands such as: 
– ALTER SYSTEM SET log_min_duration_statement 
= '5s'; 
Are now saved to postgresql.auto.conf which is 
always read last and saved between restarts.
Better updateable views 
CREATE TABLE products ( 
product_id SERIAL PRIMARY KEY, 
product_name TEXT NOT NULL, 
quantity INT, 
reserved INT DEFAULT 0); 
CREATE VIEW products_view AS 
SELECT product_id, 
product_name, 
quantity, 
(quantity - reserved) AS available 
FROM products 
WHERE quantity IS NOT NULL;
Views Continued 
postgres=# INSERT INTO products_view (product_name, quantity) VALUES 
('Budget laptop', 100), 
('Premium laptop', 10); 
INSERT 0 2 
postgres=# SELECT * FROM products; 
product_id | product_name | quantity | reserved 
------------+----------------+----------+---------- 
1 | Budget laptop | 100 | 0 
2 | Premium laptop | 10 | 0 
(2 rows)
Donate 
http://www.postgresql.org/about/donate
Questions? 
● Political 
● Community 
● Technical 
● Why the hell not?

Weitere ähnliche Inhalte

Was ist angesagt?

Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Valerii Kravchuk
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQLVu Hung Nguyen
 
High availability for puppet - 2016
High availability for puppet - 2016High availability for puppet - 2016
High availability for puppet - 2016Zack Smith
 
MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016Wagner Bianchi
 
Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1Valerii Kravchuk
 
Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]
Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]
Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]Ortus Solutions, Corp
 
MySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsMySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsSveta Smirnova
 
Do it Yourself Testing
Do it Yourself TestingDo it Yourself Testing
Do it Yourself TestingEmily Stolfo
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)Wilfried Schobeiri
 
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsValerii Kravchuk
 
Understanding MySQL Performance through Benchmarking
Understanding MySQL Performance through BenchmarkingUnderstanding MySQL Performance through Benchmarking
Understanding MySQL Performance through BenchmarkingLaine Campbell
 
PostgreSQL Monitoring using modern software stacks
PostgreSQL Monitoring using modern software stacksPostgreSQL Monitoring using modern software stacks
PostgreSQL Monitoring using modern software stacksShowmax Engineering
 
LAS16-307: Benchmarking Schedutil in Android
LAS16-307: Benchmarking Schedutil in AndroidLAS16-307: Benchmarking Schedutil in Android
LAS16-307: Benchmarking Schedutil in AndroidLinaro
 
Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013Jan Gehring
 
Lessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationSveta Smirnova
 
Webinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera ClusterWebinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera ClusterSeveralnines
 

Was ist angesagt? (19)

Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQL
 
High availability for puppet - 2016
High availability for puppet - 2016High availability for puppet - 2016
High availability for puppet - 2016
 
MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016
 
Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1
 
Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]
Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]
Brad wood - 5 CommandBox Modules You Should Be Using [Into The Box 2020]
 
Lock free programming- pro tips
Lock free programming- pro tipsLock free programming- pro tips
Lock free programming- pro tips
 
MySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsMySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAs
 
Do it Yourself Testing
Do it Yourself TestingDo it Yourself Testing
Do it Yourself Testing
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)
 
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
 
Understanding MySQL Performance through Benchmarking
Understanding MySQL Performance through BenchmarkingUnderstanding MySQL Performance through Benchmarking
Understanding MySQL Performance through Benchmarking
 
PostgreSQL Monitoring using modern software stacks
PostgreSQL Monitoring using modern software stacksPostgreSQL Monitoring using modern software stacks
PostgreSQL Monitoring using modern software stacks
 
LAS16-307: Benchmarking Schedutil in Android
LAS16-307: Benchmarking Schedutil in AndroidLAS16-307: Benchmarking Schedutil in Android
LAS16-307: Benchmarking Schedutil in Android
 
Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013Rex - Lightning Talk yapc.eu 2013
Rex - Lightning Talk yapc.eu 2013
 
Lessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting Replication
 
Daniel Sloof: Magento on HHVM
Daniel Sloof: Magento on HHVMDaniel Sloof: Magento on HHVM
Daniel Sloof: Magento on HHVM
 
Webinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera ClusterWebinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera Cluster
 
Git+jenkins+rex presentation
Git+jenkins+rex presentationGit+jenkins+rex presentation
Git+jenkins+rex presentation
 

Ähnlich wie An evening with Postgresql

PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodbPGConf APAC
 
What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3Pavan Deolasee
 
Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Python Ireland
 
Utopia Kindgoms scaling case: From 4 to 50K users
Utopia Kindgoms scaling case: From 4 to 50K usersUtopia Kindgoms scaling case: From 4 to 50K users
Utopia Kindgoms scaling case: From 4 to 50K usersJaime Buelta
 
Load testing in Zonky with Gatling
Load testing in Zonky with GatlingLoad testing in Zonky with Gatling
Load testing in Zonky with GatlingPetr Vlček
 
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORINGEko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORINGPablo Garbossa
 
Useful PostgreSQL Extensions
Useful PostgreSQL ExtensionsUseful PostgreSQL Extensions
Useful PostgreSQL ExtensionsEDB
 
Eko10 Workshop Opensource Database Auditing
Eko10  Workshop Opensource Database AuditingEko10  Workshop Opensource Database Auditing
Eko10 Workshop Opensource Database AuditingJuan Berner
 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)Aleksander Alekseev
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadKrivoy Rog IT Community
 
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...Boško Devetak
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django applicationbangaloredjangousergroup
 
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Per Henrik Lausten
 
Elephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsElephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsPostgreSQL Experts, Inc.
 
Elephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forksElephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forksCommand Prompt., Inc
 
Introduction to Postrges-XC
Introduction to Postrges-XCIntroduction to Postrges-XC
Introduction to Postrges-XCAshutosh Bapat
 
Elephants in the Cloud
Elephants in the CloudElephants in the Cloud
Elephants in the CloudMike Fowler
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartMukesh Singh
 

Ähnlich wie An evening with Postgresql (20)

PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 
What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3
 
Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+
 
Utopia Kindgoms scaling case: From 4 to 50K users
Utopia Kindgoms scaling case: From 4 to 50K usersUtopia Kindgoms scaling case: From 4 to 50K users
Utopia Kindgoms scaling case: From 4 to 50K users
 
Load testing in Zonky with Gatling
Load testing in Zonky with GatlingLoad testing in Zonky with Gatling
Load testing in Zonky with Gatling
 
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORINGEko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
 
Useful PostgreSQL Extensions
Useful PostgreSQL ExtensionsUseful PostgreSQL Extensions
Useful PostgreSQL Extensions
 
Eko10 Workshop Opensource Database Auditing
Eko10  Workshop Opensource Database AuditingEko10  Workshop Opensource Database Auditing
Eko10 Workshop Opensource Database Auditing
 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django application
 
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)
 
Elephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsElephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and Variants
 
Elephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forksElephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forks
 
Introduction to Postrges-XC
Introduction to Postrges-XCIntroduction to Postrges-XC
Introduction to Postrges-XC
 
An Introduction to Postgresql
An Introduction to PostgresqlAn Introduction to Postgresql
An Introduction to Postgresql
 
Elephants in the Cloud
Elephants in the CloudElephants in the Cloud
Elephants in the Cloud
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 

Mehr von Joshua Drake

Defining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own BusinessDefining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own BusinessJoshua Drake
 
Defining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own BusinessDefining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own BusinessJoshua Drake
 
Dumb Simple PostgreSQL Performance (NYCPUG)
Dumb Simple PostgreSQL Performance (NYCPUG)Dumb Simple PostgreSQL Performance (NYCPUG)
Dumb Simple PostgreSQL Performance (NYCPUG)Joshua Drake
 
Introduction to PgBench
Introduction to PgBenchIntroduction to PgBench
Introduction to PgBenchJoshua Drake
 
Developing A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre SqlDeveloping A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre SqlJoshua Drake
 
PostgreSQL Conference: East 08
PostgreSQL Conference: East 08PostgreSQL Conference: East 08
PostgreSQL Conference: East 08Joshua Drake
 
PostgreSQL Conference: West 08
PostgreSQL Conference: West 08PostgreSQL Conference: West 08
PostgreSQL Conference: West 08Joshua Drake
 
What MySQL can learn from PostgreSQL
What MySQL can learn from PostgreSQLWhat MySQL can learn from PostgreSQL
What MySQL can learn from PostgreSQLJoshua Drake
 
Northern Arizona State ACM talk (10/08)
Northern Arizona State ACM talk (10/08)Northern Arizona State ACM talk (10/08)
Northern Arizona State ACM talk (10/08)Joshua Drake
 

Mehr von Joshua Drake (13)

Defining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own BusinessDefining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own Business
 
Defining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own BusinessDefining Your Goal: Starting Your Own Business
Defining Your Goal: Starting Your Own Business
 
Dumb Simple PostgreSQL Performance (NYCPUG)
Dumb Simple PostgreSQL Performance (NYCPUG)Dumb Simple PostgreSQL Performance (NYCPUG)
Dumb Simple PostgreSQL Performance (NYCPUG)
 
East09 Keynote
East09 KeynoteEast09 Keynote
East09 Keynote
 
Go Replicator
Go ReplicatorGo Replicator
Go Replicator
 
Pitr Made Easy
Pitr Made EasyPitr Made Easy
Pitr Made Easy
 
Introduction to PgBench
Introduction to PgBenchIntroduction to PgBench
Introduction to PgBench
 
Developing A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre SqlDeveloping A Procedural Language For Postgre Sql
Developing A Procedural Language For Postgre Sql
 
PostgreSQL Conference: East 08
PostgreSQL Conference: East 08PostgreSQL Conference: East 08
PostgreSQL Conference: East 08
 
PostgreSQL Conference: West 08
PostgreSQL Conference: West 08PostgreSQL Conference: West 08
PostgreSQL Conference: West 08
 
What MySQL can learn from PostgreSQL
What MySQL can learn from PostgreSQLWhat MySQL can learn from PostgreSQL
What MySQL can learn from PostgreSQL
 
Northern Arizona State ACM talk (10/08)
Northern Arizona State ACM talk (10/08)Northern Arizona State ACM talk (10/08)
Northern Arizona State ACM talk (10/08)
 
Plproxy
PlproxyPlproxy
Plproxy
 

Kürzlich hochgeladen

Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 

Kürzlich hochgeladen (20)

Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 

An evening with Postgresql

  • 1. An Evening with PostgreSQL Command Prompt, Inc.
  • 2. Who Am I ● @linuxhiker ● +JoshuaDrakeLinuxHiker ● jd@commandprompt.com ● Lead Consultant – Command Prompt, Inc. ● Director – Software in the Public Interest ● President – United States PostgreSQL
  • 3. Rated: Pg-13 ● I do this for fun. This is not my day job. ● East Coast from the West Coast ● Your ego is not my concern ● To to take offense is to not be comfortable in oneself. ● Hopefully you laugh and learn
  • 4. Help control license costs If you are selling licenses to software, you are not helping control license costs.
  • 5. Proactive SLA ● Remote DBA / Sysadmin ● Proactive Response ● 4 Hours of DBA (minimum) ● SLA / 24x7 / 365 ● No Emergency/After Hours rates ● Flat, discounted rate From 1350.00/mo
  • 6. What are we talking about ● What is PostgreSQL? ● Community Structure ● Comparison to other databases ● Awesome PostgreSQL stuff + 9.4 features ● WTH were they thinking! ● Guaranteed not to be in order
  • 7. What is PostgreSQL? ● The oldest of the open source databases (derived from University Ingres 1974) ● The most advanced Open Source (possibly of closed too) database ● A full ACID compliant, relational, object-relational, document, modern, scalable database.
  • 8. Community Structure ● Everyone Welcome ● Meritocracy ● INTL: Postgresql.org ● Japan: Postgresql.jp ● EU: Postgresql.eu ● US: Postgresql.us ● Smaller ones (Brazil, France, Italy)
  • 9. Comparison to other databases ● Licensing ● Community ● No single point of failure ● Feature parity with all databases, more advanced than some ● Best of both worlds, relational or document
  • 10. Licensing BSD not GPL ● Important for commercial providers
  • 11. Community ● Large ● Vibrant ● Active ● All walks of life ● Driven by the ecosystem, not a company
  • 12. No single point of failure ● Can not be bought ● Can not go out of business ● Can not be co-opted ● Many known and qualified support/services companies (CMD, PgExperts, OmniTI, BullInfoSys, Consistent State, 2nd Quadrant)
  • 13. Feature Parity ● We have reached a point of... oh PostgreSQL ● Like MSSQL, Oracle, Sybase, just another SQL database but with neat stuff ● No longer a fringe product (thanks to Oracle)
  • 14. Standard Features ● SQL Compliance ● Partitioning ● Replication ● Tablespaces ● ACID
  • 15. AWESOME Stuff BEGIN; ALTER TABLE foo ADD COLUMN bar text; d foo COMMIT/ROLLBACK; (Mysql can't do this)
  • 16. Craziness BEGIN; CREATE TABLE foo (id serial, test text); CREATE TABLE bar (a foo); insert into bar values (row(1,'this is a test')); postgres=# select * from bar; a ---------------------- (1,"this is a test") – Say what?
  • 17. It gets better postgres=# select (a).id from bar; id ---- 1
  • 18. Wooohaa! postgres=# select row_to_json(row((a).id),true) from bar; row_to_json ------------- {"f1":1}
  • 19. Enough of that, let's talk 9.4 ● JSONB ● Logical Decoding (Including Logical Replication) ● BDR ● Wal Bouncer ● Other 9.4 stuff
  • 20. JSON ● Added in 9.2 ● Input is validated ● Stored as text representation – Slower on retrieval due to per row parse (per value?) ● Preserves key order and duplicates ● Mature support in 9.3 – Better Functions – Operators ● Advanced support in 9.4 – Type building functions ● About 15% storage overhead ● Expression only indexes (WHERE foo)
  • 21. When to use JSON ● Document storage ● Duplicate preservation ● Key order preservation
  • 22. JSONB ● 9.4+ ● Full JSON Implementation ● Stored as binary (unlike JSON) ● Works with all JSON operators ● HSTORE-style query operators ● No key order ● No duplicate preservation ● Faster access ● GIN Indexing (and expression), for containment ops use json_path_ops ● About 35% storage overhead ● Much faster than JSON for retrieval (slower than HSTORE)
  • 23. JSONB Features ● Equality operator – SELECT '{“a”: 1, “b”: 2}'::jsonb = '{“b”:2, “a”:1}'::jsonb ● Containment operator (Softserve) – SELECT '{“a”: 1, “b”: 2}'::jsonb @> {“b”:2}::jsonb ● Existence – SELECT '{“a”: 1, “b”: 2}'::jsonb ? 'b'; ● Nested operators (softserve works as well) – SELECT '{“a”: [1,2]}'::jsonb = '{“a”:[1,2]}'::jsonb ● Existence (any) - ?| ● Existence (all) - ?&
  • 24. JSON/JSBON thanks Information retrieved from PDXPUG day in 2014 via David Wheeler ● http://vimeo.com/105491487
  • 25. Logical Decoding PostgreSQL provides infrastructure to stream the modifications performed via SQL to external consumers. The format in which those changes are streamed is determined by the output plugin used. Every output plugin has access to each individual new row produced by INSERT and the new row version created by UPDATE. Availability of old row versions for UPDATE and DELETE depends on the configured REPLICA IDENTITY. It is also possible to write additional methods of consuming the output of a replication slot without modifying core code. (http://www.postgresql.org/docs/9.4/static/logicaldecoding.html)
  • 26. What does Logical Decoding Mean? ● You now have backend access to INSERT/UPDATE/DELETE mechanisms. ● Is used to implement new features such as: – BDR: https://wiki.postgresql.org/wiki/BDR_User_Guide – Auditing – Walbouncer: http://www.cybertec.at/en/products/walbouncer-enterprise-grade- partial-replication/
  • 27. BDR ● Multi-Master without triggers! (Sorry Bucardo) ● Uses LLSR (From Logical Decoding) ● Supports distributed Sequences ● Supports synchronisation functions ● Supports conflict handlers ● Highly performant ● Eventually consistent ● Up to 48 nodes
  • 28. WalBouncer ● Requires 9.4 ● Allows partial replication to remote replicas – Each replica can have a different data set ● Filters based on WAL ● Single master to many slave ● Can be disconcerting to the novice ● http://www.cybertec.at/postgresql_produkte/walbouncer/
  • 29. Other 9.4 Stuff ● GIN indexes now faster and smaller ● pg_prewarm ● ALTER SYSTEM ● Concurrent materialized view refresh ● Update Views with different columns
  • 30. ALTER SYSTEM ● Commands such as: – ALTER SYSTEM SET log_min_duration_statement = '5s'; Are now saved to postgresql.auto.conf which is always read last and saved between restarts.
  • 31. Better updateable views CREATE TABLE products ( product_id SERIAL PRIMARY KEY, product_name TEXT NOT NULL, quantity INT, reserved INT DEFAULT 0); CREATE VIEW products_view AS SELECT product_id, product_name, quantity, (quantity - reserved) AS available FROM products WHERE quantity IS NOT NULL;
  • 32. Views Continued postgres=# INSERT INTO products_view (product_name, quantity) VALUES ('Budget laptop', 100), ('Premium laptop', 10); INSERT 0 2 postgres=# SELECT * FROM products; product_id | product_name | quantity | reserved ------------+----------------+----------+---------- 1 | Budget laptop | 100 | 0 2 | Premium laptop | 10 | 0 (2 rows)
  • 34. Questions? ● Political ● Community ● Technical ● Why the hell not?