SlideShare une entreprise Scribd logo
1  sur  47
Télécharger pour lire hors ligne
PostgreSQL, your
NoSQL database
Reuven M. Lerner, PhD • reuven@lerner.co.il
DevConTLV, Monday June 22th, 2015
Who am I?
Training
• Python
• PostgreSQL
• Git
• Ruby
Writing
• Linux Journal
• Blog: http://blog.lerner.co.il/
• Tweeting: @reuvenmlerner
• ebook: "Practice Makes Python"
• E-mail courses
• My programming newsletter
Curating
• Full-stack Web development
• http://DailyTechVideo.com • @DailyTechVideo
• Learning Mandarin Chinese?
• http://MandarinWeekly.com • @MandarinWeekly
What is a database?
• Store data securely
• Retrieve data flexibly
• Do this as efficiently as possible
My first database
• Text files!
• They're really fast to work with
• They're really flexible
• But all of the data handling is in our application!
• So things are slow
• And when there's more than one user, it gets bad
Things would be better if:
• The database let us structure our data
• The database did most of the computing work (high
speed and centralized), freeing up our application
• The database handled constraints and errors
• The database took care of simultaneous reads, writes
in the form of transactions
• The database handled errors well, reporting them
rather than dying on us
Relational model
• EF Codd, an IBM researcher, proposed it in 1970
• Replaced the previous hierarchical model
• Normalized data = easier, more flexible
• Eight relational operations:
• Union, intersection, difference, product
• Selection (WHERE), projection (select a, b), join,
division
Query languages
• Codd spoke in terms of mathematics.
• This was implemented using query languages
• SQL was not the first, or the only, query language!
• Codd wrote Alpha
• Stonebreaker wrote Quel
• IBM (but not Codd!) wrote SEQUEL
• Larry Ellison made his own version of SEQUEL… and thus
was born the new, more generic name, SQL
Brief history
• 1977-1985: Ingres (Stonebreaker)
• 1986-1994: Postgres (Stonebreaker)
• 1995: Postgres + SQL = PostgreSQL
• 1996: Open-source project, run by the
“global development group”
• Ever since, one major release per year
• Current is 9.4, with 9.5 due in the autumn
It's getting popular…
• Rock solid
• High performance
• Extensible
• Heroku
• (Also: Thanks, Oracle!)
So, what is NoSQL?
• It's not really NoSQL.
• Rather, it's non-relational.
NoSQL isn't new!
• Pre-relational databases
• Object databases
• Key-value stores (e.g., Berkeley DB)
So, why NoSQL?
• Not everything is easily represented with tables
• Sometimes we want a more flexible schema — the
database equivalent of dynamic typing
• Some data is bigger, or comes faster, than a single
relational database can handle
NoSQL isn't a definition!
• "I want to travel using a non-flying vehicle."
• "I want a non-meat dinner."
• "I want to read a non-fiction book."
Key-value stores
• Examples: Redis, Riak
• Think of it as a hash table server, with typed data
• Especially useful for caching, but also good for
many name-value data sets
• Very fast, very reliable, very useful
Document databases
• Examples: MongoDB, CouchDB
• We love JSON, right? Use it to store everything!
• JSON will prevail!
What's wrong with this?
• New systems to learn, install, configure, and tune
• New query language(s) to learn, often without the
expressive power of SQL
• Non-normalized data!
• Splitting our data across different systems might
lead to duplication or corruption
• What about transactions? What about ACID?
Is NoSQL wrong?
• No, of course not.
• Different needs require different solutions.
• But let's not throw out 40+ years of database
research, just because NoSQL is new and cool.
• Engineering is all about trade-offs. There is no
perfect solution. Optimize for certain things.
When you discovered hash
tables, did you stop using arrays?
SQL vs. NoSQL
• As a developer, I can then choose between SQL
and NoSQL
• NoSQL can be faster, more flexible, and easier
• But SQL databases have a lot of advantages, and
it's a shame to throw out so many years of
advancement
But wait!
• PostgreSQL has an extension mechanism
• Add new data types
• Add new functions
• Connect to external databases
• PostgreSQL is becoming a platform for data
storage and retrieval, and not just a database
HSTORE
• HSTORE is a data type, just like INTEGER,
TIMESTAMP, or TEXT
• If you define a column as HSTORE, it can contain
key-value pairs
• Keys and values are both strings
Create a table
CREATE EXTENSION HSTORE;
CREATE TABLE People (
id SERIAL,
info HSTORE,
PRIMARY KEY(id)
);
Add a HSTORE value
INSERT INTO people(info)
VALUES ('foo=>1, bar=>abc, baz=>stuff');
Look at our values
[local]/reuven=# select * from people;
+----+------------------------------------------+
| id | info |
+----+------------------------------------------+
| 1 | "bar"=>"abc", "baz"=>"stuff", "foo"=>"1" |
+----+------------------------------------------+
(1 row)
Add (or replace) a pair
UPDATE People
SET info = info || 'abc=>def';
Remove a pair
UPDATE People
SET info = delete(info, 'abc');
What else?
• Everything you would want in a hash table…
• Check for a key
• Remove a key-value pair
• Get the keys
• Get the values
• Turn the hstore into a PostgreSQL array or JSON
Indexes
• PostgreSQL has several types of indexes
• You can index HSTORE columns with GIN and
GIST indexes, which lets you search inside
• You can also index HSTORE columns with HASH
indexes, for finding equal values
HSTORE isn't Redis
• But it does give you lots of advantages
• Super reliable
• CHECK constraints
• Combine HSTORE queries with other queries
• Transactions!
• Master-slave replication for scalability
JSON and JSONB
• In the last few versions, PostgreSQL has added
JSON support
• First, basic JSON support
• Then, some added operators
• Now, JSONB support — high-speed binary
JSON storage
Creating a table with JSONB
CREATE TABLE People (
id SERIAL,
info JSONB
);
Adding values
INSERT INTO people (info)
VALUES ('{"first":"Reuven",
"last":"Lerner"}'),
('{"first":"Atara",
"last":"Lerner-Friedman"}');
Retrieving values
select info from people;
+-----------------------------------------------+
| info |
+-----------------------------------------------+
| {"last": "Lerner", "first": "Reuven"} |
| {"last": "Lerner-Friedman", "first": "Atara"} |
+-----------------------------------------------+
(2 rows)
Extract
SELECT info->'last' as last,
info->'first' as first
FROM People;
┌───────────────────┬──────────┐
│ last │ first │
├───────────────────┼──────────┤
│ "Lerner" │ "Reuven" │
│ "Lerner-Friedman" │ "Atara" │
└───────────────────┴──────────┘
(2 rows)
Use the inside data
select * from people order by info->'first' DESC;
+----+-----------------------------------------------+
| id | info |
+----+-----------------------------------------------+
| 4 | {"last": "Lerner", "first": "Reuven"} |
| 5 | {"last": "Lerner-Friedman", "first": "Atara"} |
+----+-----------------------------------------------+
(2 rows)
JSONB operators
• Checking for existence
• Reading inside of the JSONB
• Retrieving data as text, or as JSON objects
Indexes
• You can even index your JSONB columns!
• You can use functional and partial indexes on
JSONB
Performance
• EnterpriseDB (a PostgreSQL support company)
compared JSONB with MongoDB
• High-volume inserts: PostgreSQL was 2.2x faster
than MongoDB
• Inserts: PostgreSQL was 3x faster
• Disk space: MongoDB used 35% more
• JSONB is slower than MongoDB in updates, however
Foreign data wrappers
• Let's say that you have a NoSQL database
• However, you want to integrate that data into your
PostgreSQL system
• That's fine — just use a "foreign data wrapper"
• To PostgreSQL, it looks like a table. But in reality,
it's retrieving (and setting) data in the NoSQL
database!
Using a FDW
• Download, install the extension
• Create a foreign server
• Create a foreign table
• Now you can read from and write to the foreign
table
• How is NoSQL mapped to a table? Depends on
the FDW
Available NoSQL FDWs
• Cassandra
• CouchDB
• MongoDB
• Neo4j
• Redis
• RethinkDB
Schema changes
• NoSQL loves to talk about "no schemas"
• But schemas make our data predictable, and help
us to exclude bad data
• You can always use ALTER TABLE to change the
schema — adding, removing, and renaming
columns, or even modifying data types or
constraints
Summary
• New problems can require new solutions
• But let's not give up all of the great solutions we've
created over the last few decades
• PostgreSQL has proven itself, time and again, as
an SQL solution
• But it's becoming a platform — one which includes
NoSQL data types, and integrates with NoSQL
databases
Any questions?
• Ask me now, or:
• reuven@lerner.co.il
• @reuvenmlerner
• http://lerner.co.il/

Contenu connexe

Tendances

Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...Ontico
 
Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018Jonathan Katz
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...DataStax Academy
 
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, HerokuPostgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, HerokuRedis Labs
 
ElasticSearch AJUG 2013
ElasticSearch AJUG 2013ElasticSearch AJUG 2013
ElasticSearch AJUG 2013Roy Russo
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkDvir Volk
 
Pgbr 2013 postgres on aws
Pgbr 2013   postgres on awsPgbr 2013   postgres on aws
Pgbr 2013 postgres on awsEmanuel Calvo
 
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...DataStax Academy
 
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiPostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiSatoshi Nagayasu
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitRedis Labs
 
Building a CRM on top of ElasticSearch
Building a CRM on top of ElasticSearchBuilding a CRM on top of ElasticSearch
Building a CRM on top of ElasticSearchMark Greene
 
Data analysis scala_spark
Data analysis scala_sparkData analysis scala_spark
Data analysis scala_sparkYiguang Hu
 
Redis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale AppsRedis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale AppsDave Nielsen
 
Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized ViewsCarl Yeksigian
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQLMark Wong
 
Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...
Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...
Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...Ontico
 
Cassandra 3 new features 2016
Cassandra 3 new features 2016Cassandra 3 new features 2016
Cassandra 3 new features 2016Duyhai Doan
 
Cassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupCassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupMichael Wynholds
 

Tendances (20)

Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
Полнотекстовый поиск в PostgreSQL за миллисекунды (Олег Бартунов, Александр К...
 
Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
Cassandra Summit 2014: Reading Cassandra SSTables Directly for Offline Data A...
 
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, HerokuPostgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
 
ElasticSearch AJUG 2013
ElasticSearch AJUG 2013ElasticSearch AJUG 2013
ElasticSearch AJUG 2013
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and Spark
 
Pgbr 2013 postgres on aws
Pgbr 2013   postgres on awsPgbr 2013   postgres on aws
Pgbr 2013 postgres on aws
 
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
 
Learning postgresql
Learning postgresqlLearning postgresql
Learning postgresql
 
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 TaipeiPostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
PostgreSQL 9.4, 9.5 and Beyond @ COSCUP 2015 Taipei
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbit
 
Building a CRM on top of ElasticSearch
Building a CRM on top of ElasticSearchBuilding a CRM on top of ElasticSearch
Building a CRM on top of ElasticSearch
 
Data analysis scala_spark
Data analysis scala_sparkData analysis scala_spark
Data analysis scala_spark
 
Redis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale AppsRedis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale Apps
 
Cassandra Materialized Views
Cassandra Materialized ViewsCassandra Materialized Views
Cassandra Materialized Views
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQL
 
Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...
Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...
Новые возможности полнотекстового поиска в PostgreSQL / Олег Бартунов (Postgr...
 
Cassandra 3 new features 2016
Cassandra 3 new features 2016Cassandra 3 new features 2016
Cassandra 3 new features 2016
 
Cassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL MeetupCassandra and Rails at LA NoSQL Meetup
Cassandra and Rails at LA NoSQL Meetup
 

En vedette

Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...
Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...
Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...NoSQLmatters
 
Big Data — Your new best friend
Big Data — Your new best friendBig Data — Your new best friend
Big Data — Your new best friendReuven Lerner
 
Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014Reuven Lerner
 
What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?Reuven Lerner
 
Python's magic methods
Python's magic methodsPython's magic methods
Python's magic methodsReuven Lerner
 
Technical training business talk.key
Technical training business talk.keyTechnical training business talk.key
Technical training business talk.keyReuven Lerner
 
2013 State of Cloud Survey SMB Results
2013 State of Cloud Survey SMB Results2013 State of Cloud Survey SMB Results
2013 State of Cloud Survey SMB ResultsSymantec
 
Breaking through the Clouds
Breaking through the CloudsBreaking through the Clouds
Breaking through the CloudsAndy Piper
 
2013 Future of Cloud Computing - 3rd Annual Survey Results
2013 Future of Cloud Computing - 3rd Annual Survey Results2013 Future of Cloud Computing - 3rd Annual Survey Results
2013 Future of Cloud Computing - 3rd Annual Survey ResultsMichael Skok
 
Intro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, JerusalemIntro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, JerusalemReuven Lerner
 
Can we hack open source #cloud platforms to help reduce emissions?
Can we hack open source #cloud platforms to help reduce emissions?Can we hack open source #cloud platforms to help reduce emissions?
Can we hack open source #cloud platforms to help reduce emissions?Tom Raftery
 
Summer School Scale Cloud Across the Enterprise
Summer School   Scale Cloud Across the EnterpriseSummer School   Scale Cloud Across the Enterprise
Summer School Scale Cloud Across the EnterpriseWSO2
 
Simplifying The Cloud Top 10 Questions By SMBs
Simplifying The Cloud Top 10 Questions By SMBsSimplifying The Cloud Top 10 Questions By SMBs
Simplifying The Cloud Top 10 Questions By SMBsSun Digital, Inc.
 
Penetrating the Cloud: Opportunities & Challenges for Businesses
Penetrating the Cloud: Opportunities & Challenges for BusinessesPenetrating the Cloud: Opportunities & Challenges for Businesses
Penetrating the Cloud: Opportunities & Challenges for BusinessesCompTIA
 
The Inevitable Cloud Outage
The Inevitable Cloud OutageThe Inevitable Cloud Outage
The Inevitable Cloud OutageNewvewm
 
Avoiding Cloud Outage
Avoiding Cloud OutageAvoiding Cloud Outage
Avoiding Cloud OutageNati Shalom
 
LinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud Computing
LinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud ComputingLinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud Computing
LinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud ComputingMark Hinkle
 
Delivering IaaS with Open Source Software
Delivering IaaS with Open Source SoftwareDelivering IaaS with Open Source Software
Delivering IaaS with Open Source SoftwareMark Hinkle
 

En vedette (20)

Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...
Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...
Stefan Hochdörfer - The NoSQL Store everyone ignores: PostgreSQL - NoSQL matt...
 
Desarrollo de software con bases de datos inteligentes
Desarrollo de software con bases de datos inteligentesDesarrollo de software con bases de datos inteligentes
Desarrollo de software con bases de datos inteligentes
 
Big Data — Your new best friend
Big Data — Your new best friendBig Data — Your new best friend
Big Data — Your new best friend
 
Rails israel 2013
Rails israel 2013Rails israel 2013
Rails israel 2013
 
Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014Functional Python Webinar from October 22nd, 2014
Functional Python Webinar from October 22nd, 2014
 
What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?What can Ruby learn from Python (and vice versa)?
What can Ruby learn from Python (and vice versa)?
 
Python's magic methods
Python's magic methodsPython's magic methods
Python's magic methods
 
Technical training business talk.key
Technical training business talk.keyTechnical training business talk.key
Technical training business talk.key
 
2013 State of Cloud Survey SMB Results
2013 State of Cloud Survey SMB Results2013 State of Cloud Survey SMB Results
2013 State of Cloud Survey SMB Results
 
Breaking through the Clouds
Breaking through the CloudsBreaking through the Clouds
Breaking through the Clouds
 
2013 Future of Cloud Computing - 3rd Annual Survey Results
2013 Future of Cloud Computing - 3rd Annual Survey Results2013 Future of Cloud Computing - 3rd Annual Survey Results
2013 Future of Cloud Computing - 3rd Annual Survey Results
 
Intro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, JerusalemIntro to cloud computing — MegaCOMM 2013, Jerusalem
Intro to cloud computing — MegaCOMM 2013, Jerusalem
 
Can we hack open source #cloud platforms to help reduce emissions?
Can we hack open source #cloud platforms to help reduce emissions?Can we hack open source #cloud platforms to help reduce emissions?
Can we hack open source #cloud platforms to help reduce emissions?
 
Summer School Scale Cloud Across the Enterprise
Summer School   Scale Cloud Across the EnterpriseSummer School   Scale Cloud Across the Enterprise
Summer School Scale Cloud Across the Enterprise
 
Simplifying The Cloud Top 10 Questions By SMBs
Simplifying The Cloud Top 10 Questions By SMBsSimplifying The Cloud Top 10 Questions By SMBs
Simplifying The Cloud Top 10 Questions By SMBs
 
Penetrating the Cloud: Opportunities & Challenges for Businesses
Penetrating the Cloud: Opportunities & Challenges for BusinessesPenetrating the Cloud: Opportunities & Challenges for Businesses
Penetrating the Cloud: Opportunities & Challenges for Businesses
 
The Inevitable Cloud Outage
The Inevitable Cloud OutageThe Inevitable Cloud Outage
The Inevitable Cloud Outage
 
Avoiding Cloud Outage
Avoiding Cloud OutageAvoiding Cloud Outage
Avoiding Cloud Outage
 
LinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud Computing
LinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud ComputingLinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud Computing
LinuxFest NW 2013: Hitchhiker's Guide to Open Source Cloud Computing
 
Delivering IaaS with Open Source Software
Delivering IaaS with Open Source SoftwareDelivering IaaS with Open Source Software
Delivering IaaS with Open Source Software
 

Similaire à PostgreSQL, your NoSQL database

An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.Jurriaan Persyn
 
Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014
Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014
Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014NoSQLmatters
 
Solr cloud the 'search first' nosql database extended deep dive
Solr cloud the 'search first' nosql database   extended deep diveSolr cloud the 'search first' nosql database   extended deep dive
Solr cloud the 'search first' nosql database extended deep divelucenerevolution
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQLTony Tam
 
Deep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکی
Deep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکیDeep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکی
Deep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکیEhsan Asgarian
 
Object Relational Database Management System
Object Relational Database Management SystemObject Relational Database Management System
Object Relational Database Management SystemAmar Myana
 
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL DatabasesDropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL DatabasesKyle Banerjee
 
NoSql - mayank singh
NoSql - mayank singhNoSql - mayank singh
NoSql - mayank singhMayank Singh
 
NoSql Data Management
NoSql Data ManagementNoSql Data Management
NoSql Data Managementsameerfaizan
 
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015NoSQLmatters
 
NOSQL Databases for the .NET Developer
NOSQL Databases for the .NET DeveloperNOSQL Databases for the .NET Developer
NOSQL Databases for the .NET DeveloperJesus Rodriguez
 
Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015
Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015
Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015Adrian Carr
 
Introducción a NoSQL
Introducción a NoSQLIntroducción a NoSQL
Introducción a NoSQLMongoDB
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxRahul Borate
 

Similaire à PostgreSQL, your NoSQL database (20)

Mathias test
Mathias testMathias test
Mathias test
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
 
Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014
Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014
Sebastian Cohnen – Building a Startup with NoSQL - NoSQL matters Barcelona 2014
 
MongoDB
MongoDBMongoDB
MongoDB
 
Solr cloud the 'search first' nosql database extended deep dive
Solr cloud the 'search first' nosql database   extended deep diveSolr cloud the 'search first' nosql database   extended deep dive
Solr cloud the 'search first' nosql database extended deep dive
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
 
NOsql Presentation.pdf
NOsql Presentation.pdfNOsql Presentation.pdf
NOsql Presentation.pdf
 
Deep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکی
Deep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکیDeep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکی
Deep dive to ElasticSearch - معرفی ابزار جستجوی الاستیکی
 
Object Relational Database Management System
Object Relational Database Management SystemObject Relational Database Management System
Object Relational Database Management System
 
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL DatabasesDropping ACID: Wrapping Your Mind Around NoSQL Databases
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
 
NoSQL
NoSQLNoSQL
NoSQL
 
NoSql - mayank singh
NoSql - mayank singhNoSql - mayank singh
NoSql - mayank singh
 
Hbase Nosql
Hbase NosqlHbase Nosql
Hbase Nosql
 
NoSql Data Management
NoSql Data ManagementNoSql Data Management
NoSql Data Management
 
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
Rob Harrop- Key Note The God, the Bad and the Ugly - NoSQL matters Paris 2015
 
NOSQL Databases for the .NET Developer
NOSQL Databases for the .NET DeveloperNOSQL Databases for the .NET Developer
NOSQL Databases for the .NET Developer
 
Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015
Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015
Amazing Speed: Elasticsearch for the .NET Developer- Adrian Carr, Codestock 2015
 
Introducción a NoSQL
Introducción a NoSQLIntroducción a NoSQL
Introducción a NoSQL
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
 
No sql Database
No sql DatabaseNo sql Database
No sql Database
 

Plus de Reuven Lerner

Web APIs: The future of software
Web APIs: The future of softwareWeb APIs: The future of software
Web APIs: The future of softwareReuven Lerner
 
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Reuven Lerner
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talkReuven Lerner
 
Git talk from Open 2011 conference in Israel
Git talk from Open 2011 conference in IsraelGit talk from Open 2011 conference in Israel
Git talk from Open 2011 conference in IsraelReuven Lerner
 
Dynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship groupDynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship groupReuven Lerner
 
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Reuven Lerner
 
PostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conferencePostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conferenceReuven Lerner
 

Plus de Reuven Lerner (13)

Web APIs: The future of software
Web APIs: The future of softwareWeb APIs: The future of software
Web APIs: The future of software
 
Rails traps
Rails trapsRails traps
Rails traps
 
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talk
 
Git talk from Open 2011 conference in Israel
Git talk from Open 2011 conference in IsraelGit talk from Open 2011 conference in Israel
Git talk from Open 2011 conference in Israel
 
Dynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship groupDynamic languages, for software craftmanship group
Dynamic languages, for software craftmanship group
 
Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011Modern Web Technologies — Jerusalem Web Professionals, January 2011
Modern Web Technologies — Jerusalem Web Professionals, January 2011
 
PostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conferencePostgreSQL talk, Database 2011 conference
PostgreSQL talk, Database 2011 conference
 
ActiveRecord 2.3
ActiveRecord 2.3ActiveRecord 2.3
ActiveRecord 2.3
 
Ruby objects
Ruby objectsRuby objects
Ruby objects
 
Rails console
Rails consoleRails console
Rails console
 
Rails tools
Rails toolsRails tools
Rails tools
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
 

Dernier

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Dernier (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

PostgreSQL, your NoSQL database

  • 1. PostgreSQL, your NoSQL database Reuven M. Lerner, PhD • reuven@lerner.co.il DevConTLV, Monday June 22th, 2015
  • 4. Writing • Linux Journal • Blog: http://blog.lerner.co.il/ • Tweeting: @reuvenmlerner • ebook: "Practice Makes Python" • E-mail courses • My programming newsletter
  • 5. Curating • Full-stack Web development • http://DailyTechVideo.com • @DailyTechVideo • Learning Mandarin Chinese? • http://MandarinWeekly.com • @MandarinWeekly
  • 6. What is a database? • Store data securely • Retrieve data flexibly • Do this as efficiently as possible
  • 7. My first database • Text files! • They're really fast to work with • They're really flexible • But all of the data handling is in our application! • So things are slow • And when there's more than one user, it gets bad
  • 8. Things would be better if: • The database let us structure our data • The database did most of the computing work (high speed and centralized), freeing up our application • The database handled constraints and errors • The database took care of simultaneous reads, writes in the form of transactions • The database handled errors well, reporting them rather than dying on us
  • 9. Relational model • EF Codd, an IBM researcher, proposed it in 1970 • Replaced the previous hierarchical model • Normalized data = easier, more flexible • Eight relational operations: • Union, intersection, difference, product • Selection (WHERE), projection (select a, b), join, division
  • 10. Query languages • Codd spoke in terms of mathematics. • This was implemented using query languages • SQL was not the first, or the only, query language! • Codd wrote Alpha • Stonebreaker wrote Quel • IBM (but not Codd!) wrote SEQUEL • Larry Ellison made his own version of SEQUEL… and thus was born the new, more generic name, SQL
  • 11. Brief history • 1977-1985: Ingres (Stonebreaker) • 1986-1994: Postgres (Stonebreaker) • 1995: Postgres + SQL = PostgreSQL • 1996: Open-source project, run by the “global development group” • Ever since, one major release per year • Current is 9.4, with 9.5 due in the autumn
  • 12. It's getting popular… • Rock solid • High performance • Extensible • Heroku • (Also: Thanks, Oracle!)
  • 13. So, what is NoSQL? • It's not really NoSQL. • Rather, it's non-relational.
  • 14. NoSQL isn't new! • Pre-relational databases • Object databases • Key-value stores (e.g., Berkeley DB)
  • 15. So, why NoSQL? • Not everything is easily represented with tables • Sometimes we want a more flexible schema — the database equivalent of dynamic typing • Some data is bigger, or comes faster, than a single relational database can handle
  • 16. NoSQL isn't a definition! • "I want to travel using a non-flying vehicle." • "I want a non-meat dinner." • "I want to read a non-fiction book."
  • 17. Key-value stores • Examples: Redis, Riak • Think of it as a hash table server, with typed data • Especially useful for caching, but also good for many name-value data sets • Very fast, very reliable, very useful
  • 18. Document databases • Examples: MongoDB, CouchDB • We love JSON, right? Use it to store everything! • JSON will prevail!
  • 19. What's wrong with this? • New systems to learn, install, configure, and tune • New query language(s) to learn, often without the expressive power of SQL • Non-normalized data! • Splitting our data across different systems might lead to duplication or corruption • What about transactions? What about ACID?
  • 20. Is NoSQL wrong? • No, of course not. • Different needs require different solutions. • But let's not throw out 40+ years of database research, just because NoSQL is new and cool. • Engineering is all about trade-offs. There is no perfect solution. Optimize for certain things.
  • 21. When you discovered hash tables, did you stop using arrays?
  • 22. SQL vs. NoSQL • As a developer, I can then choose between SQL and NoSQL • NoSQL can be faster, more flexible, and easier • But SQL databases have a lot of advantages, and it's a shame to throw out so many years of advancement
  • 23. But wait! • PostgreSQL has an extension mechanism • Add new data types • Add new functions • Connect to external databases • PostgreSQL is becoming a platform for data storage and retrieval, and not just a database
  • 24. HSTORE • HSTORE is a data type, just like INTEGER, TIMESTAMP, or TEXT • If you define a column as HSTORE, it can contain key-value pairs • Keys and values are both strings
  • 25. Create a table CREATE EXTENSION HSTORE; CREATE TABLE People ( id SERIAL, info HSTORE, PRIMARY KEY(id) );
  • 26. Add a HSTORE value INSERT INTO people(info) VALUES ('foo=>1, bar=>abc, baz=>stuff');
  • 27. Look at our values [local]/reuven=# select * from people; +----+------------------------------------------+ | id | info | +----+------------------------------------------+ | 1 | "bar"=>"abc", "baz"=>"stuff", "foo"=>"1" | +----+------------------------------------------+ (1 row)
  • 28. Add (or replace) a pair UPDATE People SET info = info || 'abc=>def';
  • 29. Remove a pair UPDATE People SET info = delete(info, 'abc');
  • 30. What else? • Everything you would want in a hash table… • Check for a key • Remove a key-value pair • Get the keys • Get the values • Turn the hstore into a PostgreSQL array or JSON
  • 31. Indexes • PostgreSQL has several types of indexes • You can index HSTORE columns with GIN and GIST indexes, which lets you search inside • You can also index HSTORE columns with HASH indexes, for finding equal values
  • 32. HSTORE isn't Redis • But it does give you lots of advantages • Super reliable • CHECK constraints • Combine HSTORE queries with other queries • Transactions! • Master-slave replication for scalability
  • 33. JSON and JSONB • In the last few versions, PostgreSQL has added JSON support • First, basic JSON support • Then, some added operators • Now, JSONB support — high-speed binary JSON storage
  • 34. Creating a table with JSONB CREATE TABLE People ( id SERIAL, info JSONB );
  • 35. Adding values INSERT INTO people (info) VALUES ('{"first":"Reuven", "last":"Lerner"}'), ('{"first":"Atara", "last":"Lerner-Friedman"}');
  • 36. Retrieving values select info from people; +-----------------------------------------------+ | info | +-----------------------------------------------+ | {"last": "Lerner", "first": "Reuven"} | | {"last": "Lerner-Friedman", "first": "Atara"} | +-----------------------------------------------+ (2 rows)
  • 37. Extract SELECT info->'last' as last, info->'first' as first FROM People; ┌───────────────────┬──────────┐ │ last │ first │ ├───────────────────┼──────────┤ │ "Lerner" │ "Reuven" │ │ "Lerner-Friedman" │ "Atara" │ └───────────────────┴──────────┘ (2 rows)
  • 38. Use the inside data select * from people order by info->'first' DESC; +----+-----------------------------------------------+ | id | info | +----+-----------------------------------------------+ | 4 | {"last": "Lerner", "first": "Reuven"} | | 5 | {"last": "Lerner-Friedman", "first": "Atara"} | +----+-----------------------------------------------+ (2 rows)
  • 39. JSONB operators • Checking for existence • Reading inside of the JSONB • Retrieving data as text, or as JSON objects
  • 40. Indexes • You can even index your JSONB columns! • You can use functional and partial indexes on JSONB
  • 41. Performance • EnterpriseDB (a PostgreSQL support company) compared JSONB with MongoDB • High-volume inserts: PostgreSQL was 2.2x faster than MongoDB • Inserts: PostgreSQL was 3x faster • Disk space: MongoDB used 35% more • JSONB is slower than MongoDB in updates, however
  • 42. Foreign data wrappers • Let's say that you have a NoSQL database • However, you want to integrate that data into your PostgreSQL system • That's fine — just use a "foreign data wrapper" • To PostgreSQL, it looks like a table. But in reality, it's retrieving (and setting) data in the NoSQL database!
  • 43. Using a FDW • Download, install the extension • Create a foreign server • Create a foreign table • Now you can read from and write to the foreign table • How is NoSQL mapped to a table? Depends on the FDW
  • 44. Available NoSQL FDWs • Cassandra • CouchDB • MongoDB • Neo4j • Redis • RethinkDB
  • 45. Schema changes • NoSQL loves to talk about "no schemas" • But schemas make our data predictable, and help us to exclude bad data • You can always use ALTER TABLE to change the schema — adding, removing, and renaming columns, or even modifying data types or constraints
  • 46. Summary • New problems can require new solutions • But let's not give up all of the great solutions we've created over the last few decades • PostgreSQL has proven itself, time and again, as an SQL solution • But it's becoming a platform — one which includes NoSQL data types, and integrates with NoSQL databases
  • 47. Any questions? • Ask me now, or: • reuven@lerner.co.il • @reuvenmlerner • http://lerner.co.il/