SlideShare a Scribd company logo
1 of 41
Download to read offline
Sharing Code and
Experiences
@fabriziomello
Just to stay
all of us tuned!!!
Everybody knows what a database is?
Is this a database?
Of course not!
But what wikipedia tell us?
A database is an integrated and organized
collection of logically related records or files or
data that are stored in a computer system
which consolidates records previously stored in
a separate files into a common pool of data
records that provides data for many
applications.
Source: http://en.wikipedia.org/wiki/Database
WTF???
Ok, more simple and in pt-br !!
“Bancos de dados ou bases de dados são
coleções organizadas de dados que se
relacionam de forma a criar algum sentido
(Informação) e dar mais eficiência durante uma
pesquisa ou estudo.” (Wikipedia)
Source: http://pt.wikipedia.org/wiki/Banco_de_dados
Database is a concept
Relational Database Management Systems
is the implementation of this concept
About me
● IT experience since 1993
○ Programming Languages (Basic, C, Clipper, Pascal,
PHP, Javascript, …)
○ Operating Systems (Windows “argh”, Unix and
Linux)
○ PostgreSQL, Firebird, MySQL, Oracle
○ Agile Methodologies (XP, Lean, Scrum, …)
○ …
Fabrízio de Royes Mello
Fabrízio de Royes Mello
● Bachelor in Information Systems in 2002
● Entrepeneur at http://timbira.com
● Agile Methodologies Specialization student 2014/2015
● PostgreSQL colaborator since 2008 (Brazilian
community and now the international too)
… and nowadays
● PostgreSQL contributor (more than 27
patches as developer and/or reviewer)
● Brazilian Community
○ http://postgresql.org.br
○ http://listas.postgresql.org.br
● PostgreSQL Consultant at Timbira
○ http://timbira.com.br
● Judô Practitioner
About PostgreSQL
PostgreSQL (http://postgresql.org)
● The world’s most advanced open source database
● Run in all major operating systems: Linux, UNIX (AIX,
BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and
Windows
● Fully ACID compliant (Atomicity, Consistency, Isolation
and Durability)
● Full support for foreign keys, joins, views, triggers, and
stored procedures (in multiple languages)
● Native programming interfaces for C/C++, Java, .Net,
Perl, Python, Ruby, Tcl, ODBC, among others.
PostgreSQL (http://postgresql.org)
● Before : born from INGRES
● 1986 : Project start (Berkley)
● 1987 : First Postgres version Postgres
● 1991 : (v 3) with the most of the actual features
● 1993 : (v 4.2) last released by Berkley
● 1994 : Andrew Yu and Jolly Chen release Postgre95
with support to SQL language
● 1997 : (v 6) Name changes to PostgreSQL
● 2000 : (v 7) Support to Foreign Keys
PostgreSQL (http://postgresql.org)
● 2005 : (v 8) Native port to Windows, Tablespaces,
Savepoints, Point-In-Time-Recovery
● 2005 : (v 8.1) Two-phase Commit, Roles
● 2006 : (v 8.2) [Insert, Update, Delete] Returning,
improve performance OLTP and BI
● 2008 : (v 8.3) Debug PL/PgSQL, Tsearch2 (XML)
incorporated to the core, performance improvements
● 2009 : (v 8.4) Windowing Functions, Common Table
Expressions and Recursive Queries, Parallel Restore,
“pg_upgrade”
PostgreSQL (http://postgresql.org)
● 2010 : (v 9.0) Hot Standby and Streaming Replication
● 2011 : (v 9.1) Synchronous Replicacion, FDW
(SQL/MED), CREATE EXTENSION, Unlogged Tables
● 2012 : (v 9.2) Index-only Scans, Cascading Replication,
JSON, Range Types
● 2013 : (v 9.3) Materialized Views, Lateral Join, writable
FDW, Event Triggers, Background Workers
● 2014 : (v 9.4) JSONB, Logical Decoding, Dynamic
Background Workers
PostgreSQL (http://postgresql.org)
● 2015 : (v 9.5) INSERT … ON CONFLICT UPDATE
(upsert), IMPORT FOREIGN SCHEMA, ALTER TABLE
.. SET LOGGED, Parallel Infrastructure
● 2016 : (v 9.6) Parallel Query??? BDR (Bi-directional
Replication)???
About FOOS and Google
FOSS (free and open source software) and me
● My first contact was using Linux in 1997
● I fell in love with this culture since then
● In 1999 I met PostgreSQL so since then I
knew this would be part of my life
● Because of this decision I had a lot of
troubles, including financial…
● But here I am :-)
Is a global program that
offers students stipends to
write code for open source
projects.
We have worked with the
open source community to
identify and fund exciting
projects for the upcoming
summer.
Connect students to
open source communities
GSoC and PostgreSQL
● Since 2006
● Cool projects
○ Fast GiST index build
○ New phpPgAdmin Plugin Architecture (brazilian)
○ pgAdmin database designer
○ Better indexing for ranges
○ Document collection Foreign-data Wrapper
And now my project ...
PostgreSQL 9.1 introduced a new kind of table
Unlogged Tables
What means “Unlogged”?
First we need to know what means “WAL”
PostgreSQL is Full-ACID and to guarantee data
integrity uses a standard method called
WAL (Write-Ahead Logging)
WAL (Write-Ahead Logging)
“In computer science, write-ahead logging (WAL) is a family
of techniques for providing atomicity and durability (two of
the ACID properties) in database systems.
In a system using WAL, all modifications are written to a log
before they are applied. Usually both redo and undo
information is stored in the log.”
http://en.wikipedia.org/wiki/Write-ahead_logging
Ok, and what means “Unlogged” ?
● Unlogged means that the data written in
these tables is not written to WAL.
● So it makes written really, really fast
compared to written into regular tables.
So I’ll use it to all of my tables...
● However you won’t want to do that, because
● They are neither crash-safe (an unlogged
table is automatically truncated after a crash
or unclean shutdown)
● And they are nor replicated using SR
But there are some cool use cases
● Speed ETL jobs
● Cache
● Session State
● Queues?!
● ...
And now we have the power to ...
● change from UNLOGGED to LOGGED
○ ALTER TABLE name SET LOGGED;
● change from LOGGED to UNLOGGED
○ ALTER TABLE name SET UNLOGGED;
Already committed
commit: f41872d0c1239d36ab03393c39ec0b70e9ee2a3c
author: Alvaro Herrera <alvherre@alvh.no-ip.org>
date: Fri, 22 Aug 2014 14:27:00 -0400
Implement ALTER TABLE .. SET LOGGED / UNLOGGED
This enables changing permanent (logged) tables to unlogged and
vice-versa.
(Docs for ALTER TABLE / SET TABLESPACE got shuffled in an order that
hopefully makes more sense than the original.)
Author: Fabrízio de Royes Mello
Reviewed by: Christoph Berg, Andres Freund, Thom Brown
Some tweaking by Álvaro Herrera
How it works
1. Acquire AcessExclusiveLock
2. Check dependencies
a. Cannot change temp tables
b. Check Foreign Keys
3. Change indexes “relpersistence”
4. Create new heap/toast with new relpersistence
5. Rewrite heap/toast
6. Rewrite indexes
New patch with refactoring
1. Acquire AcessExclusiveLock
2. Check dependencies
a. Cannot change temp tables
b. Check Foreign Keys
3. Create new heap/toast with new relpersistence
(pass down relpersistence to reindex_index)
4. Rewrite heap/toast
5. Rewrite indexes
Currently Caveats
● AccessExclusiveLock
● Rewrite datafiles
Future work
● Don’t rewrite datafiles when wal_level =
minimal
● Unlogged Indexes on Regular Tables
● Unlogged Materialized Views (was reverted
by Tom Lane because of the bad design)
Questions?
Special thanks to
● Stephen Frost (mentor)
● Josh Berkus and Thom Brown (organizers)
● Christoph Berg (patch review)
● Álvaro Herrera (patch review and commit)
● Maristela Kohlrausch de Andrade (my
english teacher)
● http://fabriziomello.github.io
● https://www.linkedin.com/in/fabriziomello
● @fabriziomello
My contacts
GSoC2014 - Uniritter Presentation May, 2015
GSoC2014 - Uniritter Presentation May, 2015

More Related Content

What's hot

What's hot (20)

gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
 
Ostd.ksplice.talk
Ostd.ksplice.talkOstd.ksplice.talk
Ostd.ksplice.talk
 
Masterless Distributed Computing with Riak Core - EUC 2010
Masterless Distributed Computing with Riak Core - EUC 2010Masterless Distributed Computing with Riak Core - EUC 2010
Masterless Distributed Computing with Riak Core - EUC 2010
 
adp.ceph.openstack.talk
adp.ceph.openstack.talkadp.ceph.openstack.talk
adp.ceph.openstack.talk
 
Kyotoproducts
KyotoproductsKyotoproducts
Kyotoproducts
 
From Config Management Sucks to #cfgmgmtlove
From Config Management Sucks to #cfgmgmtlove From Config Management Sucks to #cfgmgmtlove
From Config Management Sucks to #cfgmgmtlove
 
Osdc2012 xtfs.talk
Osdc2012 xtfs.talkOsdc2012 xtfs.talk
Osdc2012 xtfs.talk
 
Introduction to Tokyo Products
Introduction to Tokyo ProductsIntroduction to Tokyo Products
Introduction to Tokyo Products
 
Handout: 'Open Source Tools & Resources'
Handout: 'Open Source Tools & Resources'Handout: 'Open Source Tools & Resources'
Handout: 'Open Source Tools & Resources'
 
Debugging Your Production JVM
Debugging Your Production JVMDebugging Your Production JVM
Debugging Your Production JVM
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
 
Gsummit apis-2013
Gsummit apis-2013Gsummit apis-2013
Gsummit apis-2013
 
Batch import of large RDF datasets into Semantic MediaWiki
Batch import of large RDF datasets into Semantic MediaWikiBatch import of large RDF datasets into Semantic MediaWiki
Batch import of large RDF datasets into Semantic MediaWiki
 
Geo data analytics
Geo data analyticsGeo data analytics
Geo data analytics
 
Postgres level up
Postgres level upPostgres level up
Postgres level up
 
LMAX Disruptor - High Performance Inter-Thread Messaging Library
LMAX Disruptor - High Performance Inter-Thread Messaging LibraryLMAX Disruptor - High Performance Inter-Thread Messaging Library
LMAX Disruptor - High Performance Inter-Thread Messaging Library
 
Toku DB by Aswin
Toku DB by AswinToku DB by Aswin
Toku DB by Aswin
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012
 
Graph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDBGraph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDB
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 

Viewers also liked

Viewers also liked (20)

GSoC2014 - PGDay Ijui/RS Presentation October, 2016
GSoC2014 - PGDay Ijui/RS Presentation October, 2016 GSoC2014 - PGDay Ijui/RS Presentation October, 2016
GSoC2014 - PGDay Ijui/RS Presentation October, 2016
 
Postgres Wonderland - PGDay Cascavél 2013
Postgres Wonderland - PGDay Cascavél 2013Postgres Wonderland - PGDay Cascavél 2013
Postgres Wonderland - PGDay Cascavél 2013
 
Como posso colaborar com o PostgreSQL
Como posso colaborar com o PostgreSQLComo posso colaborar com o PostgreSQL
Como posso colaborar com o PostgreSQL
 
Keep calm and Database Continuous Deployment
Keep calm and Database Continuous DeploymentKeep calm and Database Continuous Deployment
Keep calm and Database Continuous Deployment
 
GSoC2014 - PGCon2015 Presentation June, 2015
GSoC2014 - PGCon2015 Presentation June, 2015GSoC2014 - PGCon2015 Presentation June, 2015
GSoC2014 - PGCon2015 Presentation June, 2015
 
Sharing Code and Experiences
Sharing Code and ExperiencesSharing Code and Experiences
Sharing Code and Experiences
 
Bad Smells (mal cheiros) em Bancos de Dados
Bad Smells (mal cheiros) em Bancos de DadosBad Smells (mal cheiros) em Bancos de Dados
Bad Smells (mal cheiros) em Bancos de Dados
 
Dojo plpgsql
Dojo plpgsqlDojo plpgsql
Dojo plpgsql
 
Planejador de Consultas do PostgreSQL
Planejador de Consultas do PostgreSQLPlanejador de Consultas do PostgreSQL
Planejador de Consultas do PostgreSQL
 
EXPLicando o Explain no PostgreSQL
EXPLicando o Explain no PostgreSQLEXPLicando o Explain no PostgreSQL
EXPLicando o Explain no PostgreSQL
 
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
 
יחידת הוראה לחנכה
יחידת הוראה לחנכהיחידת הוראה לחנכה
יחידת הוראה לחנכה
 
Bad Smells em Bancos de Dados
Bad Smells em Bancos de DadosBad Smells em Bancos de Dados
Bad Smells em Bancos de Dados
 
Bad Smells (mal cheiros) em Bancos de Dados
Bad Smells (mal cheiros) em Bancos de DadosBad Smells (mal cheiros) em Bancos de Dados
Bad Smells (mal cheiros) em Bancos de Dados
 
Tutorial Database Refactoring
Tutorial Database RefactoringTutorial Database Refactoring
Tutorial Database Refactoring
 
NoSQL + SQL = PostgreSQL (DBA Brasil 1.0 - São Paulo/SP)
NoSQL + SQL = PostgreSQL (DBA Brasil 1.0 - São Paulo/SP) NoSQL + SQL = PostgreSQL (DBA Brasil 1.0 - São Paulo/SP)
NoSQL + SQL = PostgreSQL (DBA Brasil 1.0 - São Paulo/SP)
 
Dojo PHP (treinanto programação orientada a objetos em PHP)
Dojo PHP (treinanto programação orientada a objetos em PHP)Dojo PHP (treinanto programação orientada a objetos em PHP)
Dojo PHP (treinanto programação orientada a objetos em PHP)
 
NoSQL + SQL = PostgreSQL (TDC2014 - Porto Alegre/RS)
NoSQL + SQL = PostgreSQL (TDC2014 - Porto Alegre/RS)NoSQL + SQL = PostgreSQL (TDC2014 - Porto Alegre/RS)
NoSQL + SQL = PostgreSQL (TDC2014 - Porto Alegre/RS)
 
PostgreSQL: How to Store Passwords Safely
PostgreSQL: How to Store Passwords SafelyPostgreSQL: How to Store Passwords Safely
PostgreSQL: How to Store Passwords Safely
 
PROCERGS 2015-03-25: Bad Smells em Bancos de Dados
PROCERGS 2015-03-25: Bad Smells em Bancos de DadosPROCERGS 2015-03-25: Bad Smells em Bancos de Dados
PROCERGS 2015-03-25: Bad Smells em Bancos de Dados
 

Similar to GSoC2014 - Uniritter Presentation May, 2015

Benchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetesBenchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetes
DoKC
 

Similar to GSoC2014 - Uniritter Presentation May, 2015 (20)

An Introduction to Postgresql
An Introduction to PostgresqlAn Introduction to Postgresql
An Introduction to Postgresql
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
Benchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetesBenchmarking for postgresql workloads in kubernetes
Benchmarking for postgresql workloads in kubernetes
 
Apache Spark 101 - Demi Ben-Ari
Apache Spark 101 - Demi Ben-AriApache Spark 101 - Demi Ben-Ari
Apache Spark 101 - Demi Ben-Ari
 
The Flow of TensorFlow
The Flow of TensorFlowThe Flow of TensorFlow
The Flow of TensorFlow
 
Introduction to Docker (and a bit more) at LSPE meetup Sunnyvale
Introduction to Docker (and a bit more) at LSPE meetup SunnyvaleIntroduction to Docker (and a bit more) at LSPE meetup Sunnyvale
Introduction to Docker (and a bit more) at LSPE meetup Sunnyvale
 
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
 
Change data capture
Change data captureChange data capture
Change data capture
 
Ceph Day Santa Clara: Keynote: Building Tomorrow's Ceph
Ceph Day Santa Clara: Keynote: Building Tomorrow's Ceph Ceph Day Santa Clara: Keynote: Building Tomorrow's Ceph
Ceph Day Santa Clara: Keynote: Building Tomorrow's Ceph
 
Ceph Day NYC: Building Tomorrow's Ceph
Ceph Day NYC: Building Tomorrow's CephCeph Day NYC: Building Tomorrow's Ceph
Ceph Day NYC: Building Tomorrow's Ceph
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
Fluent Bit: Log Forwarding at Scale
Fluent Bit: Log Forwarding at ScaleFluent Bit: Log Forwarding at Scale
Fluent Bit: Log Forwarding at Scale
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
Ceph Day SF 2015 - Keynote
Ceph Day SF 2015 - Keynote Ceph Day SF 2015 - Keynote
Ceph Day SF 2015 - Keynote
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
 
Os Lamothe
Os LamotheOs Lamothe
Os Lamothe
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsApache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic Datasets
 
DEVIEW 2013
DEVIEW 2013DEVIEW 2013
DEVIEW 2013
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFix
 

More from Fabrízio Mello

Oficina postgresql avançado_consegi2010
Oficina postgresql avançado_consegi2010Oficina postgresql avançado_consegi2010
Oficina postgresql avançado_consegi2010
Fabrízio Mello
 
Oficina postgresql basico_consegi2010
Oficina postgresql basico_consegi2010Oficina postgresql basico_consegi2010
Oficina postgresql basico_consegi2010
Fabrízio Mello
 
Database refactoring postgresql_consegi2010
Database refactoring postgresql_consegi2010Database refactoring postgresql_consegi2010
Database refactoring postgresql_consegi2010
Fabrízio Mello
 

More from Fabrízio Mello (13)

PHP e PostgreSQL: Um é pouco, dois é bom, três é demais
PHP e PostgreSQL: Um é pouco, dois é bom, três é demaisPHP e PostgreSQL: Um é pouco, dois é bom, três é demais
PHP e PostgreSQL: Um é pouco, dois é bom, três é demais
 
Bad Smells (mal cheiros) em Bancos de Dados
Bad Smells (mal cheiros) em Bancos de DadosBad Smells (mal cheiros) em Bancos de Dados
Bad Smells (mal cheiros) em Bancos de Dados
 
URCAMP (Jun2017) - Como o papel e atividades de DBA ficam no contexto da cult...
URCAMP (Jun2017) - Como o papel e atividades de DBA ficam no contexto da cult...URCAMP (Jun2017) - Como o papel e atividades de DBA ficam no contexto da cult...
URCAMP (Jun2017) - Como o papel e atividades de DBA ficam no contexto da cult...
 
DBA Brasil 2.0: Como o papel e atividades de DBA ficam no contexto da cultura...
DBA Brasil 2.0: Como o papel e atividades de DBA ficam no contexto da cultura...DBA Brasil 2.0: Como o papel e atividades de DBA ficam no contexto da cultura...
DBA Brasil 2.0: Como o papel e atividades de DBA ficam no contexto da cultura...
 
Software Delivery Like a Boss
Software Delivery Like a BossSoftware Delivery Like a Boss
Software Delivery Like a Boss
 
NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)
NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)
NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)
 
Oficina PostgreSQL Básico Latinoware 2012
Oficina PostgreSQL Básico Latinoware 2012Oficina PostgreSQL Básico Latinoware 2012
Oficina PostgreSQL Básico Latinoware 2012
 
Oficina postgresql avançado_consegi2010
Oficina postgresql avançado_consegi2010Oficina postgresql avançado_consegi2010
Oficina postgresql avançado_consegi2010
 
Oficina postgresql basico_consegi2010
Oficina postgresql basico_consegi2010Oficina postgresql basico_consegi2010
Oficina postgresql basico_consegi2010
 
Database refactoring postgresql_consegi2010
Database refactoring postgresql_consegi2010Database refactoring postgresql_consegi2010
Database refactoring postgresql_consegi2010
 
Database Refactoring PostgreSQL Urcamp Alegrete 2009
Database Refactoring PostgreSQL Urcamp Alegrete 2009Database Refactoring PostgreSQL Urcamp Alegrete 2009
Database Refactoring PostgreSQL Urcamp Alegrete 2009
 
Database Refactoring com PostgreSQL PGDay RS 2009
Database Refactoring com PostgreSQL PGDay RS 2009Database Refactoring com PostgreSQL PGDay RS 2009
Database Refactoring com PostgreSQL PGDay RS 2009
 
Refatoração Banco de Dados (Agileweekend2009)
Refatoração Banco de Dados (Agileweekend2009)Refatoração Banco de Dados (Agileweekend2009)
Refatoração Banco de Dados (Agileweekend2009)
 

Recently uploaded

Recently uploaded (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

GSoC2014 - Uniritter Presentation May, 2015

  • 2. Just to stay all of us tuned!!! Everybody knows what a database is?
  • 3. Is this a database?
  • 5. But what wikipedia tell us? A database is an integrated and organized collection of logically related records or files or data that are stored in a computer system which consolidates records previously stored in a separate files into a common pool of data records that provides data for many applications. Source: http://en.wikipedia.org/wiki/Database
  • 7. Ok, more simple and in pt-br !! “Bancos de dados ou bases de dados são coleções organizadas de dados que se relacionam de forma a criar algum sentido (Informação) e dar mais eficiência durante uma pesquisa ou estudo.” (Wikipedia) Source: http://pt.wikipedia.org/wiki/Banco_de_dados
  • 8. Database is a concept Relational Database Management Systems is the implementation of this concept
  • 10. ● IT experience since 1993 ○ Programming Languages (Basic, C, Clipper, Pascal, PHP, Javascript, …) ○ Operating Systems (Windows “argh”, Unix and Linux) ○ PostgreSQL, Firebird, MySQL, Oracle ○ Agile Methodologies (XP, Lean, Scrum, …) ○ … Fabrízio de Royes Mello
  • 11. Fabrízio de Royes Mello ● Bachelor in Information Systems in 2002 ● Entrepeneur at http://timbira.com ● Agile Methodologies Specialization student 2014/2015 ● PostgreSQL colaborator since 2008 (Brazilian community and now the international too)
  • 12.
  • 13. … and nowadays ● PostgreSQL contributor (more than 27 patches as developer and/or reviewer) ● Brazilian Community ○ http://postgresql.org.br ○ http://listas.postgresql.org.br ● PostgreSQL Consultant at Timbira ○ http://timbira.com.br ● Judô Practitioner
  • 15. PostgreSQL (http://postgresql.org) ● The world’s most advanced open source database ● Run in all major operating systems: Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows ● Fully ACID compliant (Atomicity, Consistency, Isolation and Durability) ● Full support for foreign keys, joins, views, triggers, and stored procedures (in multiple languages) ● Native programming interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others.
  • 16. PostgreSQL (http://postgresql.org) ● Before : born from INGRES ● 1986 : Project start (Berkley) ● 1987 : First Postgres version Postgres ● 1991 : (v 3) with the most of the actual features ● 1993 : (v 4.2) last released by Berkley ● 1994 : Andrew Yu and Jolly Chen release Postgre95 with support to SQL language ● 1997 : (v 6) Name changes to PostgreSQL ● 2000 : (v 7) Support to Foreign Keys
  • 17. PostgreSQL (http://postgresql.org) ● 2005 : (v 8) Native port to Windows, Tablespaces, Savepoints, Point-In-Time-Recovery ● 2005 : (v 8.1) Two-phase Commit, Roles ● 2006 : (v 8.2) [Insert, Update, Delete] Returning, improve performance OLTP and BI ● 2008 : (v 8.3) Debug PL/PgSQL, Tsearch2 (XML) incorporated to the core, performance improvements ● 2009 : (v 8.4) Windowing Functions, Common Table Expressions and Recursive Queries, Parallel Restore, “pg_upgrade”
  • 18. PostgreSQL (http://postgresql.org) ● 2010 : (v 9.0) Hot Standby and Streaming Replication ● 2011 : (v 9.1) Synchronous Replicacion, FDW (SQL/MED), CREATE EXTENSION, Unlogged Tables ● 2012 : (v 9.2) Index-only Scans, Cascading Replication, JSON, Range Types ● 2013 : (v 9.3) Materialized Views, Lateral Join, writable FDW, Event Triggers, Background Workers ● 2014 : (v 9.4) JSONB, Logical Decoding, Dynamic Background Workers
  • 19. PostgreSQL (http://postgresql.org) ● 2015 : (v 9.5) INSERT … ON CONFLICT UPDATE (upsert), IMPORT FOREIGN SCHEMA, ALTER TABLE .. SET LOGGED, Parallel Infrastructure ● 2016 : (v 9.6) Parallel Query??? BDR (Bi-directional Replication)???
  • 20. About FOOS and Google
  • 21. FOSS (free and open source software) and me ● My first contact was using Linux in 1997 ● I fell in love with this culture since then ● In 1999 I met PostgreSQL so since then I knew this would be part of my life ● Because of this decision I had a lot of troubles, including financial… ● But here I am :-)
  • 22. Is a global program that offers students stipends to write code for open source projects. We have worked with the open source community to identify and fund exciting projects for the upcoming summer.
  • 23. Connect students to open source communities
  • 24. GSoC and PostgreSQL ● Since 2006 ● Cool projects ○ Fast GiST index build ○ New phpPgAdmin Plugin Architecture (brazilian) ○ pgAdmin database designer ○ Better indexing for ranges ○ Document collection Foreign-data Wrapper
  • 25. And now my project ... PostgreSQL 9.1 introduced a new kind of table Unlogged Tables
  • 26. What means “Unlogged”? First we need to know what means “WAL” PostgreSQL is Full-ACID and to guarantee data integrity uses a standard method called WAL (Write-Ahead Logging)
  • 27. WAL (Write-Ahead Logging) “In computer science, write-ahead logging (WAL) is a family of techniques for providing atomicity and durability (two of the ACID properties) in database systems. In a system using WAL, all modifications are written to a log before they are applied. Usually both redo and undo information is stored in the log.” http://en.wikipedia.org/wiki/Write-ahead_logging
  • 28. Ok, and what means “Unlogged” ? ● Unlogged means that the data written in these tables is not written to WAL. ● So it makes written really, really fast compared to written into regular tables.
  • 29. So I’ll use it to all of my tables... ● However you won’t want to do that, because ● They are neither crash-safe (an unlogged table is automatically truncated after a crash or unclean shutdown) ● And they are nor replicated using SR
  • 30. But there are some cool use cases ● Speed ETL jobs ● Cache ● Session State ● Queues?! ● ...
  • 31. And now we have the power to ... ● change from UNLOGGED to LOGGED ○ ALTER TABLE name SET LOGGED; ● change from LOGGED to UNLOGGED ○ ALTER TABLE name SET UNLOGGED;
  • 32. Already committed commit: f41872d0c1239d36ab03393c39ec0b70e9ee2a3c author: Alvaro Herrera <alvherre@alvh.no-ip.org> date: Fri, 22 Aug 2014 14:27:00 -0400 Implement ALTER TABLE .. SET LOGGED / UNLOGGED This enables changing permanent (logged) tables to unlogged and vice-versa. (Docs for ALTER TABLE / SET TABLESPACE got shuffled in an order that hopefully makes more sense than the original.) Author: Fabrízio de Royes Mello Reviewed by: Christoph Berg, Andres Freund, Thom Brown Some tweaking by Álvaro Herrera
  • 33. How it works 1. Acquire AcessExclusiveLock 2. Check dependencies a. Cannot change temp tables b. Check Foreign Keys 3. Change indexes “relpersistence” 4. Create new heap/toast with new relpersistence 5. Rewrite heap/toast 6. Rewrite indexes
  • 34. New patch with refactoring 1. Acquire AcessExclusiveLock 2. Check dependencies a. Cannot change temp tables b. Check Foreign Keys 3. Create new heap/toast with new relpersistence (pass down relpersistence to reindex_index) 4. Rewrite heap/toast 5. Rewrite indexes
  • 36. Future work ● Don’t rewrite datafiles when wal_level = minimal ● Unlogged Indexes on Regular Tables ● Unlogged Materialized Views (was reverted by Tom Lane because of the bad design)
  • 38. Special thanks to ● Stephen Frost (mentor) ● Josh Berkus and Thom Brown (organizers) ● Christoph Berg (patch review) ● Álvaro Herrera (patch review and commit) ● Maristela Kohlrausch de Andrade (my english teacher)