SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
Sharing Code and
Experiences
@fabriziomello
About me
I was born in Dom Pedrito in the South of Brazil
But I lived in Bagé since I was 1 year old
Bagé is 236 miles away from Porto Alegre
Porto Alegre is the FISL city
In my hometown Bagé is common
people...
● … be born there
● … grow up there
● … build a family there
● … spend the entire life there
● … and die there.
Until 2005 this lifestyle
fitted with my “old” needs
Then I had an opportunity
to work 100% of my time
with FOOS
Background
● 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)
FOSS 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
But FOSS bite me awile :-)
● 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
Current implementation
1. Acquire AcessExclusiveLock
2. Check dependencies
a. Cannot change temp tables
b. Check Foreign Keys
3. Create new heap/toast with new relpersistence
4. Rewrite heap/toast
5. Rewrite indexes
Currently Caveats
● AccessExclusiveLock
● Rewrite all datafiles
PostgreSQL GSoC2015
Improve the performance of
ALTER TABLE SET LOGGED
UNLOGGED statement
Improvements
● Don’t rewrite datafiles when wal_level =
minimal
● Create wal records for datafiles when
wal_level != minimal
Main Problems
● To change an Unlogged to Logged (or vice-
versa) we need
○ Drop/Create the InitFork
○ and it is not a transactional operation
GSoC2015 : Main Problems
● ALTER TABLE ... SET LOGGED
○ if we drop the InitFork
○ and a crash occurs we're in a inconsistent state
○ in catalog the relation is marked as unlogged and
we don't have the InitFork anymore
GSoC2015 : Main Problems
● ALTER TABLE ... SET UNLOGGED
○ if we create the InitFork and the transaction
rollback or a crash occurs we're in a inconsistent
state because in the catalog the relation is marked
as logged and during the crash recovery we
truncate the relation if the InitFork exists leading us
to a inconsistent state
Idea if “wal_level = minimal”
● Acquire AcessExclusiveLock
● Check dependencies
○ Cannot change temp tables
○ Check Foreign Keys
● Create a “TransientInitFork” to crash recovery detection
● FlushRelationBuffers and fsync relation
● Drop/Create the “InitFork”
● Change Catalog
● Drop the “TransientInitFork”
Idea if “wal_level != minimal”
● Same of the “wal_level = minimal”
● Plus
○ xlog all pages of datafiles (heap, toast, index)
Questions?
Special thanks to
● GSoC2014
○ Stephen Frost (mentor)
○ Josh Berkus and Thom Brown (organizers)
○ Christoph Berg (patch review)
○ Álvaro Herrera (patch review and commit)
● GSoC2015
○ Josh Berkus and Thom Brown (organizers)
○ Ashutosh Baspat (mentor)
PGBR2015 call for papers is open!!
● When?
○ November 18, 19 and 20
● Where
○ Porto Alegre, Brasil
● http://pgbr.postgresql.org.br
GSoC2014 - PGCon2015 Presentation June, 2015

Weitere ähnliche Inhalte

Andere mochten auch

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) Fabrízio Mello
 
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)Fabrízio Mello
 
Sharing Code and Experiences
Sharing Code and ExperiencesSharing Code and Experiences
Sharing Code and ExperiencesFabrízio Mello
 
Postgres Wonderland - PGDay Cascavél 2013
Postgres Wonderland - PGDay Cascavél 2013Postgres Wonderland - PGDay Cascavél 2013
Postgres Wonderland - PGDay Cascavél 2013Fabio Telles Rodriguez
 
GSoC2014 - Uniritter Presentation May, 2015
GSoC2014 - Uniritter Presentation May, 2015GSoC2014 - Uniritter Presentation May, 2015
GSoC2014 - Uniritter Presentation May, 2015Fabrízio Mello
 
Planejador de Consultas do PostgreSQL
Planejador de Consultas do PostgreSQLPlanejador de Consultas do PostgreSQL
Planejador de Consultas do PostgreSQLFabrízio Mello
 
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...Андрей Анатольевич Ващенко
 
יחידת הוראה לחנכה
יחידת הוראה לחנכהיחידת הוראה לחנכה
יחידת הוראה לחנכהMax Rokach
 
Tutorial Database Refactoring
Tutorial Database RefactoringTutorial Database Refactoring
Tutorial Database RefactoringFabrízio Mello
 
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)Fabrízio Mello
 
PostgreSQL: How to Store Passwords Safely
PostgreSQL: How to Store Passwords SafelyPostgreSQL: How to Store Passwords Safely
PostgreSQL: How to Store Passwords SafelyJuliano Atanazio
 
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 DadosFabrízio Mello
 
Greenplum: O banco de dados open source massivamente paralelo baseado em Post...
Greenplum: O banco de dados open source massivamente paralelo baseado em Post...Greenplum: O banco de dados open source massivamente paralelo baseado em Post...
Greenplum: O banco de dados open source massivamente paralelo baseado em Post...PGDay Campinas
 
DevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di Ciurcio
DevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di CiurcioDevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di Ciurcio
DevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di CiurcioPGDay Campinas
 

Andere mochten auch (14)

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)
 
Sharing Code and Experiences
Sharing Code and ExperiencesSharing Code and Experiences
Sharing Code and Experiences
 
Postgres Wonderland - PGDay Cascavél 2013
Postgres Wonderland - PGDay Cascavél 2013Postgres Wonderland - PGDay Cascavél 2013
Postgres Wonderland - PGDay Cascavél 2013
 
GSoC2014 - Uniritter Presentation May, 2015
GSoC2014 - Uniritter Presentation May, 2015GSoC2014 - Uniritter Presentation May, 2015
GSoC2014 - Uniritter Presentation May, 2015
 
Planejador de Consultas do PostgreSQL
Planejador de Consultas do PostgreSQLPlanejador de Consultas do PostgreSQL
Planejador de Consultas do PostgreSQL
 
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
Курс лекций на программу МВА в РУДН 16 февраля 2016 Тема "Управление изменени...
 
יחידת הוראה לחנכה
יחידת הוראה לחנכהיחידת הוראה לחנכה
יחידת הוראה לחנכה
 
Tutorial Database Refactoring
Tutorial Database RefactoringTutorial Database Refactoring
Tutorial Database Refactoring
 
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
 
Greenplum: O banco de dados open source massivamente paralelo baseado em Post...
Greenplum: O banco de dados open source massivamente paralelo baseado em Post...Greenplum: O banco de dados open source massivamente paralelo baseado em Post...
Greenplum: O banco de dados open source massivamente paralelo baseado em Post...
 
DevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di Ciurcio
DevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di CiurcioDevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di Ciurcio
DevOps e PostgreSQL: Replicação de forma simplificada | Miguel Di Ciurcio
 

Ähnlich wie GSoC2014 - PGCon2015 Presentation June, 2015

Sprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdfSprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdfChristian Zellot
 
10 things, an Oracle DBA should care about when moving to PostgreSQL
10 things, an Oracle DBA should care about when moving to PostgreSQL10 things, an Oracle DBA should care about when moving to PostgreSQL
10 things, an Oracle DBA should care about when moving to PostgreSQLPostgreSQL-Consulting
 
Getting big without getting fat, in perl
Getting big without getting fat, in perlGetting big without getting fat, in perl
Getting big without getting fat, in perlDean Hamstead
 
Scalable, good, cheap
Scalable, good, cheapScalable, good, cheap
Scalable, good, cheapMarc Cluet
 
Liquibase Integration with MuleSoft
Liquibase Integration with MuleSoftLiquibase Integration with MuleSoft
Liquibase Integration with MuleSoftNeerajKumar1965
 
Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Holden Karau
 
How we use Bottle and Elasticsearch
How we use Bottle and ElasticsearchHow we use Bottle and Elasticsearch
How we use Bottle and Elasticsearchswee meng ng
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyBozhidar Bozhanov
 
POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL
POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQLPOUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL
POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQLJacek Gebal
 
Improve the deployment process step by step
Improve the deployment process step by stepImprove the deployment process step by step
Improve the deployment process step by stepDaniel Fahlke
 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)Aleksander Alekseev
 
What drives Innovation? Innovations And Technological Solutions for the Distr...
What drives Innovation? Innovations And Technological Solutions for the Distr...What drives Innovation? Innovations And Technological Solutions for the Distr...
What drives Innovation? Innovations And Technological Solutions for the Distr...Stefano Fago
 
Beyond Shuffling - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
Beyond Shuffling  - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...Beyond Shuffling  - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
Beyond Shuffling - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...Holden Karau
 
Distributed System explained (with Java Microservices)
Distributed System explained (with Java Microservices)Distributed System explained (with Java Microservices)
Distributed System explained (with Java Microservices)Mario Romano
 
Everything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is WrongEverything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is WrongTim Boudreau
 
Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersJuho Teperi
 

Ähnlich wie GSoC2014 - PGCon2015 Presentation June, 2015 (20)

Sprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdfSprint Boot & Kotlin - Meetup.pdf
Sprint Boot & Kotlin - Meetup.pdf
 
10 things, an Oracle DBA should care about when moving to PostgreSQL
10 things, an Oracle DBA should care about when moving to PostgreSQL10 things, an Oracle DBA should care about when moving to PostgreSQL
10 things, an Oracle DBA should care about when moving to PostgreSQL
 
Getting big without getting fat, in perl
Getting big without getting fat, in perlGetting big without getting fat, in perl
Getting big without getting fat, in perl
 
Scalable, good, cheap
Scalable, good, cheapScalable, good, cheap
Scalable, good, cheap
 
Liquibase Integration with MuleSoft
Liquibase Integration with MuleSoftLiquibase Integration with MuleSoft
Liquibase Integration with MuleSoft
 
Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018Validating Big Data Pipelines - Big Data Spain 2018
Validating Big Data Pipelines - Big Data Spain 2018
 
How we use Bottle and Elasticsearch
How we use Bottle and ElasticsearchHow we use Bottle and Elasticsearch
How we use Bottle and Elasticsearch
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very ugly
 
POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL
POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQLPOUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL
POUG Meetup 1st MArch 2019 - utPLSQL v3 - Testing Framework for PL/SQL
 
Improve the deployment process step by step
Improve the deployment process step by stepImprove the deployment process step by step
Improve the deployment process step by step
 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
 
Rails DB migrate SAFE.pdf
Rails DB migrate SAFE.pdfRails DB migrate SAFE.pdf
Rails DB migrate SAFE.pdf
 
What drives Innovation? Innovations And Technological Solutions for the Distr...
What drives Innovation? Innovations And Technological Solutions for the Distr...What drives Innovation? Innovations And Technological Solutions for the Distr...
What drives Innovation? Innovations And Technological Solutions for the Distr...
 
Beyond Shuffling - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
Beyond Shuffling  - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...Beyond Shuffling  - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
Beyond Shuffling - Effective Tips and Tricks for Scaling Spark (Vancouver Sp...
 
Luis Majano The Battlefield ORM
Luis Majano The Battlefield ORMLuis Majano The Battlefield ORM
Luis Majano The Battlefield ORM
 
MySQL and MariaDB Backups
MySQL and MariaDB BackupsMySQL and MariaDB Backups
MySQL and MariaDB Backups
 
Distributed System explained (with Java Microservices)
Distributed System explained (with Java Microservices)Distributed System explained (with Java Microservices)
Distributed System explained (with Java Microservices)
 
Everything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is WrongEverything You Were Taught About Java Is Wrong
Everything You Were Taught About Java Is Wrong
 
Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript Developers
 
Js basics
Js basicsJs basics
Js basics
 

Mehr von Fabrízio Mello

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 é demaisFabrízio Mello
 
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 DadosFabrízio Mello
 
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...Fabrízio Mello
 
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...Fabrízio Mello
 
Software Delivery Like a Boss
Software Delivery Like a BossSoftware Delivery Like a Boss
Software Delivery Like a BossFabrízio Mello
 
NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)
NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)
NoSQL + SQL = PostgreSQL (PGDay Campinas 2014)Fabrízio Mello
 
Oficina PostgreSQL Básico Latinoware 2012
Oficina PostgreSQL Básico Latinoware 2012Oficina PostgreSQL Básico Latinoware 2012
Oficina PostgreSQL Básico Latinoware 2012Fabrízio Mello
 
Oficina postgresql avançado_consegi2010
Oficina postgresql avançado_consegi2010Oficina postgresql avançado_consegi2010
Oficina postgresql avançado_consegi2010Fabrízio Mello
 
Oficina postgresql basico_consegi2010
Oficina postgresql basico_consegi2010Oficina postgresql basico_consegi2010
Oficina postgresql basico_consegi2010Fabrízio Mello
 
Database refactoring postgresql_consegi2010
Database refactoring postgresql_consegi2010Database refactoring postgresql_consegi2010
Database refactoring postgresql_consegi2010Fabrízio Mello
 
Database Refactoring PostgreSQL Urcamp Alegrete 2009
Database Refactoring PostgreSQL Urcamp Alegrete 2009Database Refactoring PostgreSQL Urcamp Alegrete 2009
Database Refactoring PostgreSQL Urcamp Alegrete 2009Fabrízio Mello
 
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 2009Fabrízio Mello
 
Refatoração Banco de Dados (Agileweekend2009)
Refatoração Banco de Dados (Agileweekend2009)Refatoração Banco de Dados (Agileweekend2009)
Refatoração Banco de Dados (Agileweekend2009)Fabrízio Mello
 

Mehr von 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)
 

Kürzlich hochgeladen

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

GSoC2014 - PGCon2015 Presentation June, 2015

  • 3. I was born in Dom Pedrito in the South of Brazil
  • 4. But I lived in Bagé since I was 1 year old
  • 5. Bagé is 236 miles away from Porto Alegre
  • 6. Porto Alegre is the FISL city
  • 7. In my hometown Bagé is common people... ● … be born there ● … grow up there ● … build a family there ● … spend the entire life there ● … and die there.
  • 8. Until 2005 this lifestyle fitted with my “old” needs
  • 9. Then I had an opportunity to work 100% of my time with FOOS
  • 10. Background ● 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)
  • 11. FOSS 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
  • 12. But FOSS bite me awile :-) ● Because of this decision I had a lot of troubles, including financial… ● But here I am :-)
  • 13. 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.
  • 14. Connect students to open source communities
  • 15. 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
  • 16. And now my project ... PostgreSQL 9.1 introduced a new kind of table Unlogged Tables
  • 17. 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)
  • 18. 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
  • 19. 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.
  • 20. 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
  • 21. But there are some cool use cases ● Speed ETL jobs ● Cache ● Session State ● Queues?! ● ...
  • 22. 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;
  • 23. 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
  • 24. Current implementation 1. Acquire AcessExclusiveLock 2. Check dependencies a. Cannot change temp tables b. Check Foreign Keys 3. Create new heap/toast with new relpersistence 4. Rewrite heap/toast 5. Rewrite indexes
  • 26. PostgreSQL GSoC2015 Improve the performance of ALTER TABLE SET LOGGED UNLOGGED statement
  • 27. Improvements ● Don’t rewrite datafiles when wal_level = minimal ● Create wal records for datafiles when wal_level != minimal
  • 28. Main Problems ● To change an Unlogged to Logged (or vice- versa) we need ○ Drop/Create the InitFork ○ and it is not a transactional operation
  • 29. GSoC2015 : Main Problems ● ALTER TABLE ... SET LOGGED ○ if we drop the InitFork ○ and a crash occurs we're in a inconsistent state ○ in catalog the relation is marked as unlogged and we don't have the InitFork anymore
  • 30. GSoC2015 : Main Problems ● ALTER TABLE ... SET UNLOGGED ○ if we create the InitFork and the transaction rollback or a crash occurs we're in a inconsistent state because in the catalog the relation is marked as logged and during the crash recovery we truncate the relation if the InitFork exists leading us to a inconsistent state
  • 31. Idea if “wal_level = minimal” ● Acquire AcessExclusiveLock ● Check dependencies ○ Cannot change temp tables ○ Check Foreign Keys ● Create a “TransientInitFork” to crash recovery detection ● FlushRelationBuffers and fsync relation ● Drop/Create the “InitFork” ● Change Catalog ● Drop the “TransientInitFork”
  • 32. Idea if “wal_level != minimal” ● Same of the “wal_level = minimal” ● Plus ○ xlog all pages of datafiles (heap, toast, index)
  • 34. Special thanks to ● GSoC2014 ○ Stephen Frost (mentor) ○ Josh Berkus and Thom Brown (organizers) ○ Christoph Berg (patch review) ○ Álvaro Herrera (patch review and commit) ● GSoC2015 ○ Josh Berkus and Thom Brown (organizers) ○ Ashutosh Baspat (mentor)
  • 35. PGBR2015 call for papers is open!! ● When? ○ November 18, 19 and 20 ● Where ○ Porto Alegre, Brasil ● http://pgbr.postgresql.org.br