SlideShare a Scribd company logo
1 of 31
Download to read offline
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 2001 this lifestyle 
fitted with my “old” needs
But I met this pretty woman 
and she changed my life
And now I’m a husband and father
Background (1/2) 
● 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, …) 
○ …
Background (2/2) 
● 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 
● 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)
Sharing Code and Experiences

More Related Content

Viewers also liked

Como posso colaborar com o PostgreSQL
Como posso colaborar com o PostgreSQLComo posso colaborar com o PostgreSQL
Como posso colaborar com o PostgreSQLFabrízio Mello
 
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
 
EXPLicando o Explain no PostgreSQL
EXPLicando o Explain no PostgreSQLEXPLicando o Explain no PostgreSQL
EXPLicando o Explain no 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
 
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
 
Bad Smells em Bancos de Dados
Bad Smells em Bancos de DadosBad Smells em Bancos de Dados
Bad Smells em Bancos de DadosFabrízio Mello
 
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
 
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
 

Viewers also liked (16)

Como posso colaborar com o PostgreSQL
Como posso colaborar com o PostgreSQLComo posso colaborar com o PostgreSQL
Como posso colaborar com o PostgreSQL
 
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
 
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 Тема "Управление изменени...
 
יחידת הוראה לחנכה
יחידת הוראה לחנכהיחידת הוראה לחנכה
יחידת הוראה לחנכה
 
Tutorial Database Refactoring
Tutorial Database RefactoringTutorial Database Refactoring
Tutorial Database Refactoring
 
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
 
Bad Smells em Bancos de Dados
Bad Smells em Bancos de DadosBad Smells em Bancos de Dados
Bad Smells em Bancos de Dados
 
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
 
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
 

Similar to Sharing Code and Experiences

Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
Whats wrong with postgres | PGConf EU 2019 | Craig KerstiensWhats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
Whats wrong with postgres | PGConf EU 2019 | Craig KerstiensCitus Data
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartMukesh Singh
 
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 2018Holden Karau
 
Keeping the fun in functional w/ Apache Spark @ Scala Days NYC
Keeping the fun in functional   w/ Apache Spark @ Scala Days NYCKeeping the fun in functional   w/ Apache Spark @ Scala Days NYC
Keeping the fun in functional w/ Apache Spark @ Scala Days NYCHolden Karau
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersJuho Teperi
 
Snowflake Automated Deployments / CI/CD Pipelines
Snowflake Automated Deployments / CI/CD PipelinesSnowflake Automated Deployments / CI/CD Pipelines
Snowflake Automated Deployments / CI/CD PipelinesDrew Hansen
 
Data Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch FixData Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch FixStefan Krawczyk
 
Prototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at SingaporePrototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at SingaporeDhruv Gohil
 
Scalable, good, cheap
Scalable, good, cheapScalable, good, cheap
Scalable, good, cheapMarc Cluet
 
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. mongodbWei Shan Ang
 
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
 
Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersJuho Teperi
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixC4Media
 
Data Day Seattle 2017: Scaling Data Science at Stitch Fix
Data Day Seattle 2017: Scaling Data Science at Stitch FixData Day Seattle 2017: Scaling Data Science at Stitch Fix
Data Day Seattle 2017: Scaling Data Science at Stitch FixStefan Krawczyk
 
PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)Aleksander Alekseev
 
Oracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration HustleOracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration HustleEDB
 
Improving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVMImproving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVMHolden Karau
 
Kibana+ElasticSearch+LogStash to handle Log messages on Prod servers
Kibana+ElasticSearch+LogStash to handle Log messages on Prod serversKibana+ElasticSearch+LogStash to handle Log messages on Prod servers
Kibana+ElasticSearch+LogStash to handle Log messages on Prod serversHYS Enterprise
 
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
 

Similar to Sharing Code and Experiences (20)

Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
Whats wrong with postgres | PGConf EU 2019 | Craig KerstiensWhats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
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
 
Keeping the fun in functional w/ Apache Spark @ Scala Days NYC
Keeping the fun in functional   w/ Apache Spark @ Scala Days NYCKeeping the fun in functional   w/ Apache Spark @ Scala Days NYC
Keeping the fun in functional w/ Apache Spark @ Scala Days NYC
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
 
Snowflake Automated Deployments / CI/CD Pipelines
Snowflake Automated Deployments / CI/CD PipelinesSnowflake Automated Deployments / CI/CD Pipelines
Snowflake Automated Deployments / CI/CD Pipelines
 
Data Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch FixData Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch Fix
 
Prototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at SingaporePrototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at Singapore
 
Scalable, good, cheap
Scalable, good, cheapScalable, good, cheap
Scalable, good, cheap
 
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
 
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
 
Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript Developers
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFix
 
Data Day Seattle 2017: Scaling Data Science at Stitch Fix
Data Day Seattle 2017: Scaling Data Science at Stitch FixData Day Seattle 2017: Scaling Data Science at Stitch Fix
Data Day Seattle 2017: Scaling Data Science at Stitch Fix
 
An Introduction to Postgresql
An Introduction to PostgresqlAn Introduction to Postgresql
An Introduction to Postgresql
 
PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)
 
Oracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration HustleOracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration Hustle
 
Improving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVMImproving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVM
 
Kibana+ElasticSearch+LogStash to handle Log messages on Prod servers
Kibana+ElasticSearch+LogStash to handle Log messages on Prod serversKibana+ElasticSearch+LogStash to handle Log messages on Prod servers
Kibana+ElasticSearch+LogStash to handle Log messages on Prod servers
 
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)
 

More from 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
 

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

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
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
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
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
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Sharing Code and Experiences

  • 1. Sharing Code and Experiences @fabriziomello
  • 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 2001 this lifestyle fitted with my “old” needs
  • 9. But I met this pretty woman and she changed my life
  • 10. And now I’m a husband and father
  • 11. Background (1/2) ● 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, …) ○ …
  • 12. Background (2/2) ● 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)
  • 13. 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 ● Because of this decision I had a lot of troubles, including financial… ● But here I am :-)
  • 14. 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.
  • 15. Connect students to open source communities
  • 16. 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
  • 17. And now my project ... PostgreSQL 9.1 introduced a new kind of table Unlogged Tables
  • 18. 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)
  • 19. 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
  • 20. 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.
  • 21. 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
  • 22. But there are some cool use cases ● Speed ETL jobs ● Cache ● Session State ● Queues?! ● ...
  • 23. 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;
  • 24. 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
  • 25. 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
  • 26. 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
  • 27. Currently Caveats ● AccessExclusiveLock ● Rewrite datafiles
  • 28. 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)
  • 30. 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)