SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Andere mochten auch

CV NEW NEW (1)
CV NEW NEW (1)CV NEW NEW (1)
CV NEW NEW (1)
Patra Nona
 

Andere mochten auch (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
 

Mehr von Stefanie Janine Stölting

Mehr von 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
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
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
 

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