PostgreSQL negli ultimi anni ha aggiunto funzionalita’ “nosql” ACID compliant e si propone con forza quale attore nell’era di big data.
Dopo una rapida introduzione ai dati schemaless HSTORE e JSON verranno illustrate le problematiche correlate usando un caso reale.
Is Display Advertising Still a Healthy Form of Marketing?Rise Interactive
Rise Interactive shares a recent test performed with Miami Children's Hospital to determine the effectiveness of display advertising in today's digital marketing.
Photos du MuCEM et les environs prises le 28 juin 2013.
Pour plus d'infos → http://obantravel.wordpress.com/
MuCEM's photos take the 28th june 2013.
For more infomations → http://obantravel.wordpress.com/
Is Display Advertising Still a Healthy Form of Marketing?Rise Interactive
Rise Interactive shares a recent test performed with Miami Children's Hospital to determine the effectiveness of display advertising in today's digital marketing.
Photos du MuCEM et les environs prises le 28 juin 2013.
Pour plus d'infos → http://obantravel.wordpress.com/
MuCEM's photos take the 28th june 2013.
For more infomations → http://obantravel.wordpress.com/
What's Big Data? - Big Data Tech - 2015 - FirenzeAlberto Paro
Big Data Tech - 2015 - Florence
Technologie Big Data spiegate al Management
Comprendere i concetti del bigdata e gli strumenti che esistono per affrontarli (Nosql, Hadoop/Spark) sono essenziali al management attuale per poter affrontare le sfide di domani.
La teconlogia RDF offre nuove soluzioni per la pubblicazione di Open Data di privati e Pubblica Amministrazione, con l'adozione dei Linked Open Data i provider di contenuti hanno la possibilità per la prima volta di partecipare attivamente alla creazione di un data space internazionale, libero e distribuito, la Linked Data Cloud.
Di cosa è necessario dotarsi per entrare a far parte del Web dei Dati? Quali sono le tecnologie di riferimento? In che modo cambia il rapporto provider/consumer in questa nuova ottica di pubblicazione secondo standard internazionali condivisi? Oggi partecipare alla Linked Data Cloud è possibile, così come è possibile dotarsi di nuovi strumenti per riorganizzare i processi interni di chi produce e pubblica i dati. E' il momento di comprendere che il Web dei dati è la nuova frontiera della condivisione e quindi del riuso consapevole delle informazioni.
Programmazione web libera dai frameworkFrancesca1980
Un nuovo progetto web parte quasi sempre con la domanda "che framework usiamo?" Diamo per scontato che non si possa sviluppare per il web senza fare uso di framework. Ma che succederebbe se decidessimo di sviluppare senza framework? Potremmo ottenere maggiore controllo e qualità, meno rischi e meno costi. Serve "solo" la volontà di imparare a programmare bene. Darò alcune dritte con Java e TDD.
PowerPivot and BISM Tabular share a columnar-based database engine called xVelocity. Understand some basic principles about how VertiPaq works, how data is compressed, and how you can design a data model for better optimization.
PostgreSQL's is one of the finest database systems available.
The talk will cover the history, the basic concepts of the PostgreSQL's architecture and the how the community behind the "the most advanced open source database" works.
What's Big Data? - Big Data Tech - 2015 - FirenzeAlberto Paro
Big Data Tech - 2015 - Florence
Technologie Big Data spiegate al Management
Comprendere i concetti del bigdata e gli strumenti che esistono per affrontarli (Nosql, Hadoop/Spark) sono essenziali al management attuale per poter affrontare le sfide di domani.
La teconlogia RDF offre nuove soluzioni per la pubblicazione di Open Data di privati e Pubblica Amministrazione, con l'adozione dei Linked Open Data i provider di contenuti hanno la possibilità per la prima volta di partecipare attivamente alla creazione di un data space internazionale, libero e distribuito, la Linked Data Cloud.
Di cosa è necessario dotarsi per entrare a far parte del Web dei Dati? Quali sono le tecnologie di riferimento? In che modo cambia il rapporto provider/consumer in questa nuova ottica di pubblicazione secondo standard internazionali condivisi? Oggi partecipare alla Linked Data Cloud è possibile, così come è possibile dotarsi di nuovi strumenti per riorganizzare i processi interni di chi produce e pubblica i dati. E' il momento di comprendere che il Web dei dati è la nuova frontiera della condivisione e quindi del riuso consapevole delle informazioni.
Programmazione web libera dai frameworkFrancesca1980
Un nuovo progetto web parte quasi sempre con la domanda "che framework usiamo?" Diamo per scontato che non si possa sviluppare per il web senza fare uso di framework. Ma che succederebbe se decidessimo di sviluppare senza framework? Potremmo ottenere maggiore controllo e qualità, meno rischi e meno costi. Serve "solo" la volontà di imparare a programmare bene. Darò alcune dritte con Java e TDD.
PowerPivot and BISM Tabular share a columnar-based database engine called xVelocity. Understand some basic principles about how VertiPaq works, how data is compressed, and how you can design a data model for better optimization.
PostgreSQL's is one of the finest database systems available.
The talk will cover the history, the basic concepts of the PostgreSQL's architecture and the how the community behind the "the most advanced open source database" works.
pg_chameleon MySQL to PostgreSQL replica made easyFederico Campoli
pg_chameleon is a lightweight replication system written in python. The tool can connect to the mysql replication protocol and replicate the data changes in PostgreSQL.
pg_chameleon is a lightweight replication system written in python. The tool can connect to the mysql replication protocol and replicate the data changes in PostgreSQL.
Whether the user needs to setup a permanent replica between MySQL and PostgreSQL or perform an engine migration, pg_chamaleon is the perfect tool for the job.
The talk will cover the history the current implementation and the future releases.
The audience will learn how to setup a replica from MySQL to PostgreSQL in few easy steps. There will be also a coverage on the lessons learned during the tool’s development cycle.
pg_chameleon is a lightweight replication system written in
python. The tool connects to the mysql replication protocol and replicates the data in PostgreSQL.
The history, the logic and the future of the tool.
The ninja elephant, scaling the analytics database in TranswerwiseFederico Campoli
Business intelligence and analytics is the core of any great company and Transferwise is not an exception.
The talk will start with a brief history on the legacy analytics implemented with MySQL and how we scaled up the performance using PostgreSQL. In order to get fresh data from the core MySQL databases in real time we used a modified version of pg_chameleon which also obfuscated the PII data.
The talk will also cover the challenges and the lesson learned by the developers and analysts when bridging MySQL with PostgreSQL.
The ninja elephant, scaling the analytics database in TranswerwiseFederico Campoli
Business intelligence and analytics is the core of any great company and Transferwise is not an exception.
The talk will start with a brief history on the legacy analytics implemented with MySQL and how we scaled up the performance using PostgreSQL. In order to get fresh data from the core MySQL databases in real time we used a modified version of pg_chameleon which also obfuscated the PII data.
The talk will also cover the challenges and the lesson learned by the developers and analysts when bridging MySQL with PostgreSQL.
pg_chameleon is a lightweight replication system written in python. The tool connects to the mysql replication protocol and replicates the data in PostgreSQL.
The author's tool will talk about the history, the logic behind the functions available and will give an interactive usage example.
Dealing with large databases is always a challenge. The backups and the HA procedures evolve meanwhile the database installation grow up over the time.
The talk will cover the problems solved by the DBA in four years of working with large databases, which size increased from 1.7 TB single cluster, up to 40 TB in a multi shard environment.
The talk will cover either the disaster recovery with pg_dump and the high availability with the log shipping/streaming replication.
PostgreSQL - backup and recovery with large databasesFederico Campoli
Life on a rollercoaster, backup and recovery with large databases
Dealing with large databases is always a challenge.
The backups and the HA procedures evolve meanwhile the database installation grow up over the time.
The talk will cover the problems solved by the DBA in four years of working with large databases, which size increased from 1.7 TB single cluster, up to 40 TB in a multi shard environment.
The talk will cover either the disaster recovery with pg_dump and the high availability with the log shipping/streaming replication.
The presentation is based on a real story. The names are changed in order to protect the innocents.
Slides from the Brighton PostgreSQL meetup presentation. An all around PostgreSQL exploration. The rocky physical layer, the treacherous MVCC’s swamp and the buffer manager’s garden.
The paperback version is available on lulu.com there http://goo.gl/fraa8o
This is the first volume of the postgresql database administration book. The book covers the steps for installing, configuring and administering a PostgreSQL 9.3 on Linux debian. The book covers the logical and physical aspect of PostgreSQL. Two chapters are dedicated to the backup/restore topic.
PostgreSQL is a wild beast and a wrong approach can become a slow descent into hell. We'll talk about common mistakes, confusing jargon, the online manual's lost pages (well hidden in the source code) and best practices to avoid headaches for your DBA.
1. PostgreSQL, The Big, The Fast and The Ugly
Il piu' avanzato database open source come big data player
Federico Campoli
Brandwatch.com
25 Ottobre 2014
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 1 / 34
2. Sommario
1 PostgreSQL, una storia di eccellenza
2 The Big
3 The Fast
4 The Ugly
5 Conclusioni
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 2 / 34
3. Sommario
1 PostgreSQL, una storia di eccellenza
2 The Big
3 The Fast
4 The Ugly
5 Conclusioni
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 3 / 34
4. PostgreSQL, una storia di eccellenza
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 4 / 34
5. PostgreSQL, una storia di eccellenza
Creato all'universita' di Berkeley nel 1982 dal Prof. Stonebraker
Nel 1994 Andrew Yu e Jolly Chen aggiungono l'interprete SQL
Nel 1996 diventa un progetto Open Source prendendo il nome di PostgreSQL
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 5 / 34
6. PostgreSQL, una storia di eccellenza
Creato all'universita' di Berkeley nel 1982 dal Prof. Stonebraker
Nel 1994 Andrew Yu e Jolly Chen aggiungono l'interprete SQL
Nel 1996 diventa un progetto Open Source prendendo il nome di PostgreSQL
Totalmente ACID compliant
Alta scalabilita' con MVCC
Tablespace
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 5 / 34
7. PostgreSQL, una storia di eccellenza
Creato all'universita' di Berkeley nel 1982 dal Prof. Stonebraker
Nel 1994 Andrew Yu e Jolly Chen aggiungono l'interprete SQL
Nel 1996 diventa un progetto Open Source prendendo il nome di PostgreSQL
Totalmente ACID compliant
Alta scalabilita' con MVCC
Tablespace
Disponibile per numerosi unix
avours
Dalla versione 8.0 e' nativo su *cough* MS Windows *cough*
High Availability fornita da hot standby e streaming replication
Federation verso fonti dati eterogenee
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 5 / 34
8. PostgreSQL, una storia di eccellenza
Creato all'universita' di Berkeley nel 1982 dal Prof. Stonebraker
Nel 1994 Andrew Yu e Jolly Chen aggiungono l'interprete SQL
Nel 1996 diventa un progetto Open Source prendendo il nome di PostgreSQL
Totalmente ACID compliant
Alta scalabilita' con MVCC
Tablespace
Disponibile per numerosi unix
avours
Dalla versione 8.0 e' nativo su *cough* MS Windows *cough*
High Availability fornita da hot standby e streaming replication
Federation verso fonti dati eterogenee
Numerosi linguaggi procedurali (pl/pgsql, pl/python, pl/perl...)
Supporto per tipi dato schemaless come HSTORE e JSON
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 5 / 34
9. PostgreSQL, una storia di eccellenza
Sviluppo
Programmato in linguaggio C
Numerose versioni supportate
Versioni supportate a lungo termine (almeno 5 anni)
Espandibile con l'uso di librerie esterne
Supporto per le estensioni (dalla versione 9.1)
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 6 / 34
10. PostgreSQL, una storia di eccellenza
Limiti
Dimensione massima database. Illimitata.
Dimensione massima singola tabella, 32 TB
Dimensione massima singola riga 1.6 TB
Numero massimo di righe per tabella. Illimitate.
Numero massimo di campi per tabella, 250 1600 a seconda del tipo dati.
Numero massimo tabelle. Illimitato.
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 7 / 34
11. PostgreSQL, una storia di eccellenza
Insieme ai tipi dato comuni, PostgreSQL fornisce alcuni tipi decisamente esotici.
Range
Dati geometrici
Indirizzi di rete
XML
JSON
HSTORE (extension)
Gli ultimi due sono oggetto della presentazione in quanto molto popolari
nell'universo NOSQL.
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 8 / 34
12. Sommario
1 PostgreSQL, una storia di eccellenza
2 The Big
3 The Fast
4 The Ugly
5 Conclusioni
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 9 / 34
13. The Big
Image by Caitlin - https://www.
ickr.com/people/50194168@N00
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 10 / 34
14. The Big
JSON - JavaScript Object Notation
JSON supportato come tipo nativo dalla versione 9.2
La 9.3 introduce numerose funzioni di supporto
Lo storage e' praticamente testo
La sintassi JSON viene validata al volo
La struttura JSON viene gestita dal database
Dalla versione 9.4 appare JSONB (binario) che migliora notevolmente le
performance
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 11 / 34
15. The Big
JSON - Esempi
Da record a JSON
postgres=# SELECT row_to_json(ROW(1,'foo'));
row_to_json
---------------------
{"f1":1,"f2":"foo"}
(1 row)
Espansione di JSON in elementi key to value
postgres=# SELECT * from json_each('{"a":"foo", "b":"bar"}');
key | value
-----+-------
a | "foo"
b | "bar"
(2 rows)
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 12 / 34
16. The Big
HSTORE e' un tipo dato per elementi key to value
Supportato come estensione
I dati sono memorizzati come testo
Una libreria condivisa transforma il testo nel tipo HSTORE
Simile a json ma senza elementi annidati
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 13 / 34
17. The Big
HSTORE - Esempi
Da record a HSTORE
postgres=# SELECT hstore(ROW(1,2));
hstore
----------------------
"f1"=>"1", "f2"=>"2"
(1 row)
Espansione di HSTORE in elementi key to value
postgres=# SELECT * FROM each('a=>1,b=>2');
key | value
-----+-------
a | 1
b | 2
(2 rows)
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 14 / 34
18. The Big
C'e' una dierenza sottile tra HSTORE e JSON. Poiche' HSTORE e' un
estensione la manipolazione del dato avviene grazie ad una libreria esterna.
Questo, combinato con il modo in cui PostgreSQL trasforma il datum quando
viene caricato in memoria, puo avere eetti anche drammatici sulle performance.
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 15 / 34
19. Sommario
1 PostgreSQL, una storia di eccellenza
2 The Big
3 The Fast
4 The Ugly
5 Conclusioni
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 16 / 34
20. The Fast
Image by Hein Waschefort -
http://commons.wikimedia.org/wiki/User:Hein waschefort
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 17 / 34
22. ssa chiamate pagine. Ogni
pagina e' solitamente di 8kb con un header usato per garantire la durabilita'.
Figure : Data page
Dopo l'header c'e' una lista di puntatori alle tuple
23. siche. Ogni tupla e'
strutturata come un array di dati il cui tipo e' inizialmente sconosciuto.
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 18 / 34
24. The Fast
Lo stream di dati in tale stato e' chiamato datum. Una volta caricato in memoria
PostgreSQL risolve il tipo memorizzato usando il catalogo di sistema.
Figure : Tuple structure
Lo header di tupla e' parte dell'implementazione MVCC.
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 19 / 34
25. The Fast
Per ogni tupla caricata in memoria il dato viene trasformato da datum a tipo
reale. Le routine di conversione variano a seconda del tipo eettivo.
Un elemento nativo come JSON esegue quindi le routine che sono codi
26. cate
internamente al motore di database.
Di contro una trasformazione HSTORE genera un accesso alla libreria esterna per
ogni tupla esaminata in memoria.
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 20 / 34
27. The Fast
Nonostante JSON sia un dato nativo non e' detto che le sue performance siano
migliori di HSTORE. La validazione e il parsing al volo sono un potenziale
bottleneck se la quantita' di dati e' importante.
Questo problema viene risolto dal nuovo tipo binario JSONB introdotto con
PostgreSQL 9.4. Tutte le routine di validazione e trasformazione avvengono
durante le DML.
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 21 / 34
28. Sommario
1 PostgreSQL, una storia di eccellenza
2 The Big
3 The Fast
4 The Ugly
5 Conclusioni
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 22 / 34
29. The Ugly
Image by D. Gordon E. Robertson -
http://commons.wikimedia.org/wiki/User:Dger
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 23 / 34
30. The Ugly
Un caso reale, Brandwatch
Social media analytics
Dati real time e storici
Core database PostgreSQL
Big Data!!!!!
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 24 / 34
31. The Ugly
Tanto tempo fa in un datacentre lontano lontano...(Ottobre 2012)
1 database per analytics
Dimensione di soltanto 1.2 TB
Struttura denormalizzata
Storage schemaless con HSTORE
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 25 / 34
32. The Ugly
Qualche tempo dopo, Giugno 2014...
10 shards per l'analisi dei dati
Dimensione complessiva di 25 TB
HSTORE e denormalizzazione
Sistemi costantemente sovraccarichi
Crescita storage di 300 GB al giorno
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 26 / 34
33. The Ugly
Il problema... HSTORE
Sovraccarica la CPU
Storage poco eciente
Dati a volte incoerenti
Dicile da manutenere
Estremamente pratico
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 27 / 34
34. The Ugly
La soluzione... il buon vecchio storage columnar
Riduzione dello spazio del 30%
Carico di CPU ridotto ai minimi termini
Dati consistenti
Crescita ridotta a soli 50 GB al giorno
HSTORE usato solo come input per le procedure
Apertura a successivi miglioramenti
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 28 / 34
35. Sommario
1 PostgreSQL, una storia di eccellenza
2 The Big
3 The Fast
4 The Ugly
5 Conclusioni
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 29 / 34
36. Conclusioni
I dati schemaless sono molto comodi, permettono grande
essibilita' se
implementati correttamente.
L'assenza di scalabilita' orizzontale in PostgreSQL ne limita l'utilizzo se la
quantita' di dati e' importante.
Un promettente progetto in tal senso e' PostgreSQL XL -
http://www.postgres-xl.org/
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 30 / 34
37. Domande
Domande?
Per favore siate semplici, dopo tutto sono soltanto un elettricista...
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 31 / 34
38. Contatti
Twitter: 4thdoctor scarf
Blog su PostgreSQL: http://www.pgdba.co.uk
PostgreSQL Book:
http://www.slideshare.net/FedericoCampoli/postgresql-dba-01
Lavoro: http://www.brandwatch.com/
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 32 / 34
39. Licenza
Licenza CC Attribuzione - Non commerciale - Condividi allo stesso modo 3.0
http://creativecommons.org/licenses/by-nc-sa/3.0/it/deed.it
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 33 / 34
40. PostgreSQL, The Big, The Fast and The Ugly
Il piu' avanzato database open source come big data player
Federico Campoli
Brandwatch.com
25 Ottobre 2014
Federico Campoli (Brandwatch.com) PostgreSQL, The Big, The Fast and The Ugly 25 Ottobre 2014 34 / 34