JSON By The Other Elephant

Stefanie Janine Stölting
Stefanie Janine StöltingPostgreSQL Enthusiast at Self Employed
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
1 of 11

Recommended

Mooreland Monitor - Future of Payments - Retail (May 2014) by
Mooreland Monitor - Future of Payments - Retail (May 2014)Mooreland Monitor - Future of Payments - Retail (May 2014)
Mooreland Monitor - Future of Payments - Retail (May 2014)Inga Barchan
393 views14 slides
Group english about renewable resource by
Group english about renewable resourceGroup english about renewable resource
Group english about renewable resourceryfadhilla
351 views5 slides
LawGeex gives you back your TIME. by
LawGeex gives you back your TIME.LawGeex gives you back your TIME.
LawGeex gives you back your TIME.Manson Ho
190 views5 slides
Seminario 2 de investigación penal by
Seminario 2 de investigación penalSeminario 2 de investigación penal
Seminario 2 de investigación penalmvillafranca
253 views27 slides
Rapport de stage jibin Lin by
Rapport de stage jibin LinRapport de stage jibin Lin
Rapport de stage jibin LinJibin Lin
823 views54 slides
A purification and protein analysis of Granulosis virus from P by
A purification and protein analysis of Granulosis virus from PA purification and protein analysis of Granulosis virus from P
A purification and protein analysis of Granulosis virus from PChad Schlagel
297 views8 slides

More Related Content

Viewers also liked

Scaling xtext by
Scaling xtextScaling xtext
Scaling xtextLieven Lemiengre
510 views23 slides
Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom... by
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
515 views4 slides
Pup it Ups by
Pup it UpsPup it Ups
Pup it UpsCharity Luzader
333 views10 slides
CV NEW NEW (1) by
CV NEW NEW (1)CV NEW NEW (1)
CV NEW NEW (1)Patra Nona
293 views3 slides
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme... by
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
439 views23 slides
How To Celebrate Labor Day by
How To Celebrate Labor DayHow To Celebrate Labor Day
How To Celebrate Labor DayMaidPro Central CT
227 views8 slides

Viewers also liked(8)

Marcella Marletta - Workshop "Il governo dell'innovazione farmaceutica" - Rom... by Marcella Marletta
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 Marletta515 views
CV NEW NEW (1) by Patra Nona
CV NEW NEW (1)CV NEW NEW (1)
CV NEW NEW (1)
Patra Nona293 views
RCC K&L / KNVvK themadag Slim hergebruik van restwarmte 22 okt. 2015 - Algeme... by RCCKL
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...
RCCKL439 views
Kailash Mansarovar Yatra Package 2015 by kailashyatrantp
Kailash Mansarovar Yatra Package 2015Kailash Mansarovar Yatra Package 2015
Kailash Mansarovar Yatra Package 2015
kailashyatrantp343 views

More from Stefanie Janine Stölting

PostgreSQL As Data Integration Tool by
PostgreSQL As Data Integration ToolPostgreSQL As Data Integration Tool
PostgreSQL As Data Integration ToolStefanie Janine Stölting
155 views11 slides
No sql the-sql-way by
No sql the-sql-wayNo sql the-sql-way
No sql the-sql-wayStefanie Janine Stölting
505 views50 slides
One Database To Rule 'em All by
One Database To Rule 'em AllOne Database To Rule 'em All
One Database To Rule 'em AllStefanie Janine Stölting
329 views48 slides
NoSQL The SQL Way by
NoSQL The SQL WayNoSQL The SQL Way
NoSQL The SQL WayStefanie Janine Stölting
317 views49 slides
One Database To Rule 'em All by
One Database To Rule 'em AllOne Database To Rule 'em All
One Database To Rule 'em AllStefanie Janine Stölting
377 views38 slides
One Database to Rule 'em all (FrOSCon 11) by
One Database to Rule 'em all (FrOSCon 11)One Database to Rule 'em all (FrOSCon 11)
One Database to Rule 'em all (FrOSCon 11)Stefanie Janine Stölting
354 views39 slides

Recently uploaded

360 graden fabriek by
360 graden fabriek360 graden fabriek
360 graden fabriekinfo33492
165 views25 slides
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... by
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...Stefan Wolpers
42 views38 slides
Ports-and-Adapters Architecture for Embedded HMI by
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIBurkhard Stubert
33 views19 slides
Page Object Model by
Page Object ModelPage Object Model
Page Object Modelartembondar5
6 views5 slides
ADDO_2022_CICID_Tom_Halpin.pdf by
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdfTomHalpin9
5 views33 slides
tecnologia18.docx by
tecnologia18.docxtecnologia18.docx
tecnologia18.docxnosi6702
5 views5 slides

Recently uploaded(20)

360 graden fabriek by info33492
360 graden fabriek360 graden fabriek
360 graden fabriek
info33492165 views
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... by Stefan Wolpers
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
Stefan Wolpers42 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert33 views
ADDO_2022_CICID_Tom_Halpin.pdf by TomHalpin9
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdf
TomHalpin95 views
tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67025 views
Understanding HTML terminology by artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar57 views
FOSSLight Community Day 2023-11-30 by Shane Coughlan
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30
Shane Coughlan7 views
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium... by Lisi Hocke
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Lisi Hocke35 views
JioEngage_Presentation.pptx by admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254558 views
Bootstrapping vs Venture Capital.pptx by Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic15 views
Airline Booking Software by SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta9 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi216 views
Navigating container technology for enhanced security by Niklas Saari by Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy15 views
AI and Ml presentation .pptx by FayazAli87
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptx
FayazAli8714 views
Electronic AWB - Electronic Air Waybill by Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 5 views
Automated Testing of Microsoft Power BI Reports by RTTS
Automated Testing of Microsoft Power BI ReportsAutomated Testing of Microsoft Power BI Reports
Automated Testing of Microsoft Power BI Reports
RTTS10 views

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