SlideShare a Scribd company logo
© Copyright EnterpriseDB Corporation, 2019. All rights reserved.1
Pulse of Postgres
© Copyright EnterpriseDB Corporation, 2019. All rights reserved.2
What’s new in Postgres 12 August 28
Installing Postgres on Linux September 11
Installing Postgres in Containers September 25
Installing Postgres on Windows October 9
JSON and JSONPATH in Postgres 12 October 23
Programming the SQL Way with Common Table Expressions November 6
Deploying highly available Postgres using Kubernetes Operators November 20
JSON and JSONPATH in
Postgres 12
A step-by-step approach
Thom Brown, Principal Support Engineer
Marc Linster, SVP, Product Development and Support
© Copyright EnterpriseDB Corporation, 2019. All rights reserved.3
Agenda
● Who is EDB?
● The EDB Postgres Platform
● JSON, JSONB and JSONPATH
● Demo
● Q & A
● What’s next in Pulse on Postgres?
© Copyright EnterpriseDB Corporation, 2019. All rights reserved.4
WHO IS EDB?
The world leader in
open-source based Postgres
software and services
5
• Founded in 2004
• Recognized RDBMS leader by:
• Gartner
• Forrester
• Customer base > 4000
• 300+ employees
• Offices worldwide
• Largest PostgreSQL
community leader
ONLY OPEN
SOURCE BASED
RDBMS IN
GARTNER MQ
EDB Recognized 6 Years
In A Row on Gartner’s
Magic Quadrant
6
7
Customers working SMARTER, reducing RISK and being more PRODUCTIVE with EDB.
OVER 4,000 CUSTOMERS
U.S Customers
EMEA Customers APAC Customers
102
of the Fortune
500
337
of the Forbes
Global 2000
EDB OPEN SOURCE LEADERSHIP
NAMED EDB OPEN SOURCE COMMITTERS AND CONTRIBUTORS
8
• CORE TEAM
• • •
• MAJOR CONTRIBUTORS • CONTRIBUTORS
Akshay
Joshi
Amul
Sul
Ashesh
Vashi
Dilip
Kumar
Jeevan
Ladhe
Mithun
Cy
Andres
Freund
Devrim
Gündüz
Amit
Kapila
Bruce
Momjian
Dave
Page
Robert
Haas
Ashutos
h
Sharma
Rushabh
Lathia
- designates committers
jsquery &
SQL/JSON
9
jsquery and SQL/JSON provide way to query
and retrieve JSON data using expressions
passed to a function or specialised operator.
jsquery
10
• Introduced for PostgreSQL 9.4 and
later
• Provided way to query and index
JSON data
• External project not available in-core
• Not officially supported
• Introduced in PostgreSQL 12
• Provides a way to query and index
JSON data
• In-core and officially supported
• Standards-compliant
SQL/JSON
Both operate on JSONB (binary-represented JSON), and not plain JSON.
Installation
11
jsquery SQL/JSON
• Install or compile extension
• Load extension into specific
database
• Use extension types and functions
• Use built-in types and functions
SQL/JSON functions
12
Function Operator Description
jsonb_path_exists @? Match returns true, false if unmatched, null if it
targeted a missing value.
jsonb_path_match @@ Same but only first result item is tested.
jsonb_path_query None Returns JSON data resulting from expression.
jsonb_path_query_array None Same but in an array.
jsonb_path_query_first None Same but only first value.
Comparison: variables
13
jsquery jsonpath Description
$ $ The whole document
. . Accessor
* * All values at the current level
N/A ** All values at all levels
#N $[N] Nth value of an array starting at 0
N/A $[start,end] Slice of an array
# Alternative All array elements
% Alternative All object keys
Comparison: methods
14
jsquery jsonpath Description
N/A + and - (unary) Plus / minus operator on a sequence
N/A + and - (binary) Addition / subtraction
N/A * and / Multiplication / division
IS <type> type() Checks the type (jsquery) or returns the type name
(jsonpath)
@# size() Size (length) of an array
N/A double(),
ceiling(),
floor(), abs(),
keyvalue()
Math operations, and keyvalue() returns the object
represented as a sequence of key, value and id
fields.
Comparison: operators
15
jsquery jsonpath Description
=,<,<=,>,>= ==,<,<=,>,>= Equality, less than, etc.
@>,<@ Available at
SQL level
Contains / contained in
IN Alternative Multiplication / division
&& Available at
SQL level
Checks the type (jsquery) or returns the type name
(jsonpath)
AND,OR,NOT &&,||,! Boolean AND, OR and NOT.
=* exists Expression contains 1 or more items
N/A starts with Value begins with the specified value
N/A like_regex Test string against regular expression
Comparison: special values
16
jsquery jsonpath Description
true true Boolean true
false false Boolean false
null null Null value (not the same as SQL null)
N/A is unknown Unknown result
Examples
17
Q & A
© Copyright EnterpriseDB Corporation, 2019. All rights reserved.18
Upcoming events
Pulse of
Postgres
Programming the SQL
Way with Common
Table Expressions
Nov 6
Deploying highly
available Postgres using
Kubernetes Operators
Nov 20

More Related Content

What's hot (20)

PDF
Getting Started with PostGIS
EDB
 
PPTX
EDB Postgres Platform 11 Webinar
EDB
 
PPTX
Automating Postgres Deployments on AWS and VMware, with Terraform and Ansible
EDB
 
PDF
EDB Failover Manager - Features and Demo
EDB
 
PDF
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
EDB
 
PPTX
How to Monitor Postgres Like a Pro!
EDB
 
PPTX
New Approaches to Migrating from Oracle to Enterprise-Ready Postgres in the C...
EDB
 
PPTX
Webinar: Managing Postgres at Scale
EDB
 
PDF
Why Care Risk Choose PostgreSQL
EDB
 
PDF
The Real Scoop on Migrating from Oracle Databases
EDB
 
PPTX
An Expert Guide to Migrating Legacy Databases to PostgreSQL
EDB
 
PDF
Which Postgres is Right for You?
EDB
 
PDF
Avoiding.the.pitfallsof.oracle.migration.2013
EDB
 
PDF
Key Methodologies for Migrating from Oracle to Postgres
EDB
 
PDF
Migrating from Oracle to Postgres
EDB
 
PDF
Exploring Postgres with Bruce Momjian
EDB
 
PPTX
EDB's Migration Portal - Migrate from Oracle to Postgres
EDB
 
PPTX
The Need For Speed - Strategies to Modernize Your Data Center
EDB
 
PDF
Postgres Deployment Automation with Terraform and Ansible
EDB
 
PPTX
NoSQL on ACID: Meet Unstructured Postgres
EDB
 
Getting Started with PostGIS
EDB
 
EDB Postgres Platform 11 Webinar
EDB
 
Automating Postgres Deployments on AWS and VMware, with Terraform and Ansible
EDB
 
EDB Failover Manager - Features and Demo
EDB
 
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
EDB
 
How to Monitor Postgres Like a Pro!
EDB
 
New Approaches to Migrating from Oracle to Enterprise-Ready Postgres in the C...
EDB
 
Webinar: Managing Postgres at Scale
EDB
 
Why Care Risk Choose PostgreSQL
EDB
 
The Real Scoop on Migrating from Oracle Databases
EDB
 
An Expert Guide to Migrating Legacy Databases to PostgreSQL
EDB
 
Which Postgres is Right for You?
EDB
 
Avoiding.the.pitfallsof.oracle.migration.2013
EDB
 
Key Methodologies for Migrating from Oracle to Postgres
EDB
 
Migrating from Oracle to Postgres
EDB
 
Exploring Postgres with Bruce Momjian
EDB
 
EDB's Migration Portal - Migrate from Oracle to Postgres
EDB
 
The Need For Speed - Strategies to Modernize Your Data Center
EDB
 
Postgres Deployment Automation with Terraform and Ansible
EDB
 
NoSQL on ACID: Meet Unstructured Postgres
EDB
 

Similar to Json and Jsonpath in Postgres 12 (20)

PDF
NoSQL on ACID - Meet Unstructured Postgres
EDB
 
PDF
JDBC Next: A New Asynchronous API for Connecting to a Database
Yolande Poirier
 
PDF
Postgres NoSQL - Delivering Apps Faster
EDB
 
PDF
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Ontico
 
PDF
Presto: Distributed SQL on Anything - Strata Hadoop 2017 San Jose, CA
kbajda
 
PDF
NoSQL and Spatial Database Capabilities using PostgreSQL
EDB
 
PPT
The NoSQL Way in Postgres
EDB
 
PDF
Silicon Valley JUG meetup July 18, 2018
Oracle Developers
 
PDF
Optimizer percona live_ams2015
Manyi Lu
 
PPTX
RESTful application with JAX-RS and how to expose and test them
Kumaraswamy M
 
PDF
No sql way_in_pg
Vibhor Kumar
 
PDF
Migrating to postgresql
botsplash.com
 
PDF
Intro to JavaScript Testing
Ran Mizrahi
 
PDF
MySQL 8.0 Optimizer Guide
Morgan Tocker
 
PPTX
REST Enabling Your Oracle Database
Jeff Smith
 
PDF
Enterprise Postgres
Oracle Korea
 
PPTX
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Lucas Jellema
 
PPTX
What's new in DB2 for i - IBM i 7.3 TR1 and IBM i 7.2 TR5 - final.pptx
CesarDuarteMoreno
 
PDF
Change RelationalDB to GraphDB with OrientDB
Apaichon Punopas
 
PPTX
Introduction to the aerospike jdbc driver
Alexander Radzin
 
NoSQL on ACID - Meet Unstructured Postgres
EDB
 
JDBC Next: A New Asynchronous API for Connecting to a Database
Yolande Poirier
 
Postgres NoSQL - Delivering Apps Faster
EDB
 
Postgres vs Mongo / Олег Бартунов (Postgres Professional)
Ontico
 
Presto: Distributed SQL on Anything - Strata Hadoop 2017 San Jose, CA
kbajda
 
NoSQL and Spatial Database Capabilities using PostgreSQL
EDB
 
The NoSQL Way in Postgres
EDB
 
Silicon Valley JUG meetup July 18, 2018
Oracle Developers
 
Optimizer percona live_ams2015
Manyi Lu
 
RESTful application with JAX-RS and how to expose and test them
Kumaraswamy M
 
No sql way_in_pg
Vibhor Kumar
 
Migrating to postgresql
botsplash.com
 
Intro to JavaScript Testing
Ran Mizrahi
 
MySQL 8.0 Optimizer Guide
Morgan Tocker
 
REST Enabling Your Oracle Database
Jeff Smith
 
Enterprise Postgres
Oracle Korea
 
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Lucas Jellema
 
What's new in DB2 for i - IBM i 7.3 TR1 and IBM i 7.2 TR5 - final.pptx
CesarDuarteMoreno
 
Change RelationalDB to GraphDB with OrientDB
Apaichon Punopas
 
Introduction to the aerospike jdbc driver
Alexander Radzin
 
Ad

More from EDB (20)

PDF
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
EDB
 
PDF
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
PDF
Migre sus bases de datos Oracle a la nube
EDB
 
PDF
EFM Office Hours - APJ - July 29, 2021
EDB
 
PDF
Benchmarking Cloud Native PostgreSQL
EDB
 
PDF
Las Variaciones de la Replicación de PostgreSQL
EDB
 
PDF
Is There Anything PgBouncer Can’t Do?
EDB
 
PDF
Data Analysis with TensorFlow in PostgreSQL
EDB
 
PDF
Practical Partitioning in Production with Postgres
EDB
 
PDF
A Deeper Dive into EXPLAIN
EDB
 
PDF
IOT with PostgreSQL
EDB
 
PDF
A Journey from Oracle to PostgreSQL
EDB
 
PDF
Psql is awesome!
EDB
 
PDF
EDB 13 - New Enhancements for Security and Usability - APJ
EDB
 
PPTX
Comment sauvegarder correctement vos données
EDB
 
PDF
Cloud Native PostgreSQL - Italiano
EDB
 
PDF
New enhancements for security and usability in EDB 13
EDB
 
PPTX
Best Practices in Security with PostgreSQL
EDB
 
PDF
Cloud Native PostgreSQL - APJ
EDB
 
PDF
Best Practices in Security with PostgreSQL
EDB
 
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
EDB
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
Migre sus bases de datos Oracle a la nube
EDB
 
EFM Office Hours - APJ - July 29, 2021
EDB
 
Benchmarking Cloud Native PostgreSQL
EDB
 
Las Variaciones de la Replicación de PostgreSQL
EDB
 
Is There Anything PgBouncer Can’t Do?
EDB
 
Data Analysis with TensorFlow in PostgreSQL
EDB
 
Practical Partitioning in Production with Postgres
EDB
 
A Deeper Dive into EXPLAIN
EDB
 
IOT with PostgreSQL
EDB
 
A Journey from Oracle to PostgreSQL
EDB
 
Psql is awesome!
EDB
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB
 
Comment sauvegarder correctement vos données
EDB
 
Cloud Native PostgreSQL - Italiano
EDB
 
New enhancements for security and usability in EDB 13
EDB
 
Best Practices in Security with PostgreSQL
EDB
 
Cloud Native PostgreSQL - APJ
EDB
 
Best Practices in Security with PostgreSQL
EDB
 
Ad

Recently uploaded (20)

PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 

Json and Jsonpath in Postgres 12

  • 1. © Copyright EnterpriseDB Corporation, 2019. All rights reserved.1
  • 2. Pulse of Postgres © Copyright EnterpriseDB Corporation, 2019. All rights reserved.2 What’s new in Postgres 12 August 28 Installing Postgres on Linux September 11 Installing Postgres in Containers September 25 Installing Postgres on Windows October 9 JSON and JSONPATH in Postgres 12 October 23 Programming the SQL Way with Common Table Expressions November 6 Deploying highly available Postgres using Kubernetes Operators November 20
  • 3. JSON and JSONPATH in Postgres 12 A step-by-step approach Thom Brown, Principal Support Engineer Marc Linster, SVP, Product Development and Support © Copyright EnterpriseDB Corporation, 2019. All rights reserved.3
  • 4. Agenda ● Who is EDB? ● The EDB Postgres Platform ● JSON, JSONB and JSONPATH ● Demo ● Q & A ● What’s next in Pulse on Postgres? © Copyright EnterpriseDB Corporation, 2019. All rights reserved.4
  • 5. WHO IS EDB? The world leader in open-source based Postgres software and services 5 • Founded in 2004 • Recognized RDBMS leader by: • Gartner • Forrester • Customer base > 4000 • 300+ employees • Offices worldwide • Largest PostgreSQL community leader
  • 6. ONLY OPEN SOURCE BASED RDBMS IN GARTNER MQ EDB Recognized 6 Years In A Row on Gartner’s Magic Quadrant 6
  • 7. 7 Customers working SMARTER, reducing RISK and being more PRODUCTIVE with EDB. OVER 4,000 CUSTOMERS U.S Customers EMEA Customers APAC Customers 102 of the Fortune 500 337 of the Forbes Global 2000
  • 8. EDB OPEN SOURCE LEADERSHIP NAMED EDB OPEN SOURCE COMMITTERS AND CONTRIBUTORS 8 • CORE TEAM • • • • MAJOR CONTRIBUTORS • CONTRIBUTORS Akshay Joshi Amul Sul Ashesh Vashi Dilip Kumar Jeevan Ladhe Mithun Cy Andres Freund Devrim Gündüz Amit Kapila Bruce Momjian Dave Page Robert Haas Ashutos h Sharma Rushabh Lathia - designates committers
  • 9. jsquery & SQL/JSON 9 jsquery and SQL/JSON provide way to query and retrieve JSON data using expressions passed to a function or specialised operator.
  • 10. jsquery 10 • Introduced for PostgreSQL 9.4 and later • Provided way to query and index JSON data • External project not available in-core • Not officially supported • Introduced in PostgreSQL 12 • Provides a way to query and index JSON data • In-core and officially supported • Standards-compliant SQL/JSON Both operate on JSONB (binary-represented JSON), and not plain JSON.
  • 11. Installation 11 jsquery SQL/JSON • Install or compile extension • Load extension into specific database • Use extension types and functions • Use built-in types and functions
  • 12. SQL/JSON functions 12 Function Operator Description jsonb_path_exists @? Match returns true, false if unmatched, null if it targeted a missing value. jsonb_path_match @@ Same but only first result item is tested. jsonb_path_query None Returns JSON data resulting from expression. jsonb_path_query_array None Same but in an array. jsonb_path_query_first None Same but only first value.
  • 13. Comparison: variables 13 jsquery jsonpath Description $ $ The whole document . . Accessor * * All values at the current level N/A ** All values at all levels #N $[N] Nth value of an array starting at 0 N/A $[start,end] Slice of an array # Alternative All array elements % Alternative All object keys
  • 14. Comparison: methods 14 jsquery jsonpath Description N/A + and - (unary) Plus / minus operator on a sequence N/A + and - (binary) Addition / subtraction N/A * and / Multiplication / division IS <type> type() Checks the type (jsquery) or returns the type name (jsonpath) @# size() Size (length) of an array N/A double(), ceiling(), floor(), abs(), keyvalue() Math operations, and keyvalue() returns the object represented as a sequence of key, value and id fields.
  • 15. Comparison: operators 15 jsquery jsonpath Description =,<,<=,>,>= ==,<,<=,>,>= Equality, less than, etc. @>,<@ Available at SQL level Contains / contained in IN Alternative Multiplication / division && Available at SQL level Checks the type (jsquery) or returns the type name (jsonpath) AND,OR,NOT &&,||,! Boolean AND, OR and NOT. =* exists Expression contains 1 or more items N/A starts with Value begins with the specified value N/A like_regex Test string against regular expression
  • 16. Comparison: special values 16 jsquery jsonpath Description true true Boolean true false false Boolean false null null Null value (not the same as SQL null) N/A is unknown Unknown result
  • 18. Q & A © Copyright EnterpriseDB Corporation, 2019. All rights reserved.18
  • 19. Upcoming events Pulse of Postgres Programming the SQL Way with Common Table Expressions Nov 6 Deploying highly available Postgres using Kubernetes Operators Nov 20