openday - postgresql: primi passi con json/jsonb

19
PostgreSQL OpenDay 27.02.2016 Approccio NoSQL JSON / JSONB Enrico Pirozzi – [email protected]

Upload: pgtraining

Post on 15-Apr-2017

1.213 views

Category:

Technology


0 download

TRANSCRIPT

PostgreSQL OpenDay 27.02.2016

Approccio NoSQL

JSON / JSONB

Enrico Pirozzi – [email protected]

PostgreSQL OpenDay 27.02.2016

“I discovered JSON. I do not claim to have invented JSON, because it

already existed in nature.”

(Douglas Crockford)

PostgreSQL OpenDay 27.02.2016● Aggiunto dalla versione 9.2

● Validazione dei dati

● Memorizzato come testo

● Utilizza l'encoding del server

● Conserva l'ordine delle chiavi e dei duplicati

● Operatori e funzioni aggiunte dalla 9.3

PostgreSQL OpenDay 27.02.2016

Let's Start !!

PostgreSQL OpenDay 27.02.2016

Esempi di operatori JSON

PostgreSQL OpenDay 27.02.2016

Possiamo seguire i path !!!!

PostgreSQL OpenDay 27.02.2016

I Path non hanno più segreti !!!

PostgreSQL OpenDay 27.02.2016

Anche all'interno degli array

PostgreSQL OpenDay 27.02.2016

Costruiamo il nostro json

PostgreSQL OpenDay 27.02.2016

Anche su dati complessi !!!

PostgreSQL OpenDay 27.02.2016

E creiamo una tabella…...

PostgreSQL OpenDay 27.02.2016

Occhio all'intruso !!! JSONB

PostgreSQL OpenDay 27.02.2016

Dati eterogenei !!

PostgreSQL OpenDay 27.02.2016

Gli operatori in più JSON B=

PostgreSQL OpenDay 27.02.2016

Gli operatori in più JSON B@>

PostgreSQL OpenDay 27.02.2016

Gli operatori in più JSON B?| any exist

PostgreSQL OpenDay 27.02.2016

Gli operatori in più JSON B?& all exists

PostgreSQL OpenDay 27.02.2016

Le perfomance !!!!!!!!

Possibilità di creare indici di tipo GIN

PostgreSQL OpenDay 27.02.2016

GRAZIE PER L'ATTENZIONE