SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

En vedette

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
 

En vedette (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
 

Plus 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
 

Dernier

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
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
 
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...kalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
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
 
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
 
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
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
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.pdfproinshot.com
 
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 GoalsJhone kinadey
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
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.docxComplianceQuest1
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 

Dernier (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
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
 
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...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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
 
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
 
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
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
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
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
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
 
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
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

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