SlideShare uma empresa Scribd logo
1 de 11
JSON by the other elephant
PHP Usergroup Berlin
July 2015
Stefanie Janine Stölting
JSON
● JavaScript Object Notation
● Don't have to care about encoding, it is always
UTF8
● Used for data exchange in web application
● Currently two standards RFC 7159 by Douglas
Crockford und ECMA-404
● PostgreSQL impementation is RFC 7159
CTE
Common Table Expressions will be used in examples
● Example:
WITH RECURSIVE t(n) AS (
VALUES (1)
UNION ALL
SELECT n+1 FROM t WHERE n < 100
)
SELECT sum(n), min(n), max(n) FROM t;
●
Result:
JSON Datatypes
● JSON
– Available since 9.2
● JSONB
– Available since 9.4
– Crompessed JSON
JSON Functions
● row_to_json({row})
Returns the row as JSON
● array_to_json({array})
Returns the array as JSON
●
JSON Opertators
● Array Element
->{int}
● Object Element
->> {text}
Index on JSON
● Index JSONB content for faster access with indexes
– GIN index overall
● CREATE INDEX idx_1 ON jsonb.actor USING
GIN (jsondata);
– Even unique B-Tree indexes are possible
● CREATE UNIQUE INDEX actor_id_2 ON
jsonb.actor((CAST(jsondata->>'actor_id' AS
INTEGER)));
New JSON functions
● With the next version, 9.5, there will be new functions
available.
– jsonb_pretty
– jsonb_set
● If you can't wait using them, you might be interested
in the jsonbx extentsion available at PGXN
User Group / Conferences
PostgreSQL User Group Berlin
PostgreSQL Europe Conference 2015
Vienna, October 27-30
German PostgreSQL Conference 2015
Hamburg, November 26-27
Link List
Extended JSONB functions for 9.5
Extended JSONB functions as extension for 9.4
as extension from PGXN (jsonbx)
Sakila database from MySQL
pgloader to convert the Sakila database into
PostgreSQL
JSON by the other
Elephant
This is licencensed by Stefanie Janine Stölting as
Attribution 4.0 International (CC BY 4.0).
Find me on Twitter as @sjstoelting

Mais conteúdo relacionado

Destaque

Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...
Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...
Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...Marcella Marletta
 
CV NEW NEW (1)
CV NEW NEW (1)CV NEW NEW (1)
CV NEW NEW (1)Patra Nona
 
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...RCCKL
 
Kailash Mansarovar Yatra Package 2015
Kailash Mansarovar Yatra Package 2015Kailash Mansarovar Yatra Package 2015
Kailash Mansarovar Yatra Package 2015kailashyatrantp
 

Destaque (8)

Scaling xtext
Scaling xtextScaling xtext
Scaling xtext
 
Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...
Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...
Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom...
 
Pup it Ups
Pup it UpsPup it Ups
Pup it Ups
 
CV NEW NEW (1)
CV NEW NEW (1)CV NEW NEW (1)
CV NEW NEW (1)
 
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme...
 
How To Celebrate Labor Day
How To Celebrate Labor DayHow To Celebrate Labor Day
How To Celebrate Labor Day
 
Kailash Mansarovar Yatra Package 2015
Kailash Mansarovar Yatra Package 2015Kailash Mansarovar Yatra Package 2015
Kailash Mansarovar Yatra Package 2015
 
DMG v4
DMG v4DMG v4
DMG v4
 

Mais de Stefanie Janine Stölting (12)

PostgreSQL As Data Integration Tool
PostgreSQL As Data Integration ToolPostgreSQL As Data Integration Tool
PostgreSQL As Data Integration Tool
 
No sql the-sql-way
No sql the-sql-wayNo sql the-sql-way
No sql the-sql-way
 
One Database To Rule 'em All
One Database To Rule 'em AllOne Database To Rule 'em All
One Database To Rule 'em All
 
NoSQL The SQL Way
NoSQL The SQL WayNoSQL The SQL Way
NoSQL The SQL Way
 
One Database To Rule 'em All
One Database To Rule 'em AllOne Database To Rule 'em All
One Database To Rule 'em All
 
One Database to Rule 'em all (FrOSCon 11)
One Database to Rule 'em all (FrOSCon 11)One Database to Rule 'em all (FrOSCon 11)
One Database to Rule 'em all (FrOSCon 11)
 
NoSQL as Not Only SQL (FrOSCon 11)
NoSQL as Not Only SQL (FrOSCon  11)NoSQL as Not Only SQL (FrOSCon  11)
NoSQL as Not Only SQL (FrOSCon 11)
 
The PostgreSQL JSON Feature Tour
The PostgreSQL JSON Feature TourThe PostgreSQL JSON Feature Tour
The PostgreSQL JSON Feature Tour
 
JSON By Example
JSON By ExampleJSON By Example
JSON By Example
 
NoSQL as Not Only SQL
NoSQL as Not Only SQLNoSQL as Not Only SQL
NoSQL as Not Only SQL
 
One Databyse To Rule 'em All
One Databyse To Rule 'em AllOne Databyse To Rule 'em All
One Databyse To Rule 'em All
 
Meet the-other-elephant
Meet the-other-elephantMeet the-other-elephant
Meet the-other-elephant
 

Último

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Último (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

JSON By The Other Elephant

  • 1. JSON by the other elephant PHP Usergroup Berlin July 2015 Stefanie Janine Stölting
  • 2. JSON ● JavaScript Object Notation ● Don't have to care about encoding, it is always UTF8 ● Used for data exchange in web application ● Currently two standards RFC 7159 by Douglas Crockford und ECMA-404 ● PostgreSQL impementation is RFC 7159
  • 3. CTE Common Table Expressions will be used in examples ● Example: WITH RECURSIVE t(n) AS ( VALUES (1) UNION ALL SELECT n+1 FROM t WHERE n < 100 ) SELECT sum(n), min(n), max(n) FROM t; ● Result:
  • 4. JSON Datatypes ● JSON – Available since 9.2 ● JSONB – Available since 9.4 – Crompessed JSON
  • 5. JSON Functions ● row_to_json({row}) Returns the row as JSON ● array_to_json({array}) Returns the array as JSON ●
  • 6. JSON Opertators ● Array Element ->{int} ● Object Element ->> {text}
  • 7. Index on JSON ● Index JSONB content for faster access with indexes – GIN index overall ● CREATE INDEX idx_1 ON jsonb.actor USING GIN (jsondata); – Even unique B-Tree indexes are possible ● CREATE UNIQUE INDEX actor_id_2 ON jsonb.actor((CAST(jsondata->>'actor_id' AS INTEGER)));
  • 8. New JSON functions ● With the next version, 9.5, there will be new functions available. – jsonb_pretty – jsonb_set ● If you can't wait using them, you might be interested in the jsonbx extentsion available at PGXN
  • 9. User Group / Conferences PostgreSQL User Group Berlin PostgreSQL Europe Conference 2015 Vienna, October 27-30 German PostgreSQL Conference 2015 Hamburg, November 26-27
  • 10. Link List Extended JSONB functions for 9.5 Extended JSONB functions as extension for 9.4 as extension from PGXN (jsonbx) Sakila database from MySQL pgloader to convert the Sakila database into PostgreSQL
  • 11. JSON by the other Elephant This is licencensed by Stefanie Janine Stölting as Attribution 4.0 International (CC BY 4.0). Find me on Twitter as @sjstoelting