SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
pgloader
Nordic pgDay 2018, Oslo
Dimitri Fontaine
@tapoueh
March 13, 2018
Dimitri Fontaine @tapoueh pgloader March 13, 2018 1 / 18
Load data into PostgreSQL. Fast.
http://pgloader.io/
Dimitri Fontaine @tapoueh pgloader March 13, 2018 2 / 18
Load data into PostgreSQL. Fast.
http://pgloader.io/
Dimitri Fontaine @tapoueh pgloader March 13, 2018 3 / 18
pgloader: Open Source, github
https://github.com/dimitri/pgloader
Dimitri Fontaine @tapoueh pgloader March 13, 2018 4 / 18
File based formats
Dimitri Fontaine @tapoueh pgloader March 13, 2018 5 / 18
Load from a live connection
http://pgloader.io/howto/mysql.html
Dimitri Fontaine @tapoueh pgloader March 13, 2018 6 / 18
pgloader : Transfom data on the fly
http://pgloader.io/
Dimitri Fontaine @tapoueh pgloader March 13, 2018 7 / 18
Using a command language
LOAD CSV
FROM inline (x, y, a, b, c, d)
INTO postgresql:///pgloader?csv (a, b, d, c)
WITH truncate,
skip header = 1,
fields optionally enclosed by '"',
fields escaped by double-quote,
fields terminated by ','
SET work_mem to '12MB',
standard_conforming_strings to 'on'
Dimitri Fontaine @tapoueh pgloader March 13, 2018 8 / 18
with extra before/after sections
BEFORE LOAD DO
$$ drop table if exists csv; $$,
$$ create table csv (
a bigint,
b bigint,
c char(2),
d text
);
$$;
Dimitri Fontaine @tapoueh pgloader March 13, 2018 9 / 18
Some data source examples
FROM stdin
FROM inline (a, b, c)
FROM data/2013_Gaz_113CDs_national.txt
FROM FILENAME MATCHING ~/GeoLiteCity-Location.csv/
FROM ALL FILENAMES MATCHING ~/ALIOR/
FROM ALL FILENAMES MATCHING ~/F[A-Z]{4}1[45]|OZ20/
FROM http://www.census.gov/geo/maps-data/
data/docs/gazetteer/places2k.zip
FROM http://www.insee.fr/fr/methodes/nomenclatures/
cog/telechargement/2013/dbf/historiq2013.zip
Dimitri Fontaine @tapoueh pgloader March 13, 2018 10 / 18
On the fly data transformations
FROM FILENAME MATCHING ~/GeoLiteCity-Blocks.csv/
WITH ENCODING iso-8859-1
(
startIpNum, endIpNum, locId
)
INTO postgresql:///ip4r?geolite.blocks
(
iprange ip4r using (ip-range startIpNum endIpNum),
locId
)
Dimitri Fontaine @tapoueh pgloader March 13, 2018 11 / 18
On the fly processing useful for CASTing too
Empty string and NULL, default values, zero dates 0000-00-00, int(11),
float(20,2), tinyint rather than boolean, sets, ...
Oh, and encodings too
Dimitri Fontaine @tapoueh pgloader March 13, 2018 12 / 18
Here’s how to migrate from MySQL to PostgreSQL
In one command line.
$ pgloader mysql://user@localhost/sakila 
pgsql:///pagila
Dimitri Fontaine @tapoueh pgloader March 13, 2018 13 / 18
pgloader mysql://root@localhost/sakila pgsql:///pagila
table name read imported errors total time read write
----------------------------- --------- --------- --------- -------------- --------- ---------
before load 3 3 0 0.008s
fetch meta data 86 86 0 0.184s
create, drop 0 18 0 0.244s
----------------------------- --------- --------- --------- -------------- --------- ---------
actor 200 200 0 0.011s 0.021s 0.010s
address 603 603 0 0.038s 0.040s 0.037s
category 16 16 0 0.007s 0.006s 0.007s
city 600 600 0 0.037s 0.034s 0.036s
country 109 109 0 0.009s 0.026s 0.009s
customer 599 599 0 0.022s 0.077s 0.021s
films 1000 1000 0 0.052s 0.097s 0.051s
......
inventory 4581 4581 0 0.057s 0.190s 0.057s
language 6 6 0 0.003s 0.011s 0.003s
payment 16049 16049 0 0.246s 0.500s 0.245s
rental 16044 16044 0 0.329s 0.623s 0.329s
staff 2 2 0 0.025s 0.007s 0.025s
store 2 2 0 0.094s 0.010s 0.094s
actor_info 200 200 0 0.013s 1.020s 0.012s
mv.customer_list 599 599 0 0.022s 0.047s 0.022s
mv.film_list 997 997 0 0.046s 0.172s 0.046s
----------------------------- --------- --------- --------- -------------- --------- ---------
COPY Threads Completion 69 69 0 2.076s
Create Indexes 41 41 0 0.489s
Index Build Completion 41 41 0 0.002s
Reset Sequences 0 13 0 0.030s
Primary Keys 16 16 0 0.018s
Foreign Keys 22 44 0 0.156s
Install comments 0 0 0 0.000s
----------------------------- --------- --------- --------- -------------- --------- ---------
Total import time 50086 50086 0 2.788s 3.572s 1.151s
Dimitri Fontaine @tapoueh pgloader March 13, 2018 14 / 18
And more to come
File formats with on-the-fly normalisation
Dimitri Fontaine @tapoueh pgloader March 13, 2018 15 / 18
Other database systems
Dimitri Fontaine @tapoueh pgloader March 13, 2018 16 / 18
You can become a sponsor!
http://pgloader.io/pgloader-moral-license.html
Dimitri Fontaine @tapoueh pgloader March 13, 2018 17 / 18
Load data into PostgreSQL. Fast.
http://pgloader.io/
Dimitri Fontaine @tapoueh pgloader March 13, 2018 18 / 18

Weitere ähnliche Inhalte

Ähnlich wie pg_loader | Nordic PGDay 2018 | Dimitri Fontaine

Ae01 system overview
Ae01 system overviewAe01 system overview
Ae01 system overviewconfidencial
 
18c and 19c features for DBAs
18c and 19c features for DBAs18c and 19c features for DBAs
18c and 19c features for DBAsConnor McDonald
 
All AI Roads lead to Distribution - Dot AI
All AI Roads lead to Distribution - Dot AIAll AI Roads lead to Distribution - Dot AI
All AI Roads lead to Distribution - Dot AIJim Dowling
 
Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Yu-Shuan Hsieh
 
ADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs Presentation
ADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs PresentationADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs Presentation
ADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs Presentationprashant3535
 
Latin America Tour 2019 - 18c and 19c featues
Latin America Tour 2019   - 18c and 19c featuesLatin America Tour 2019   - 18c and 19c featues
Latin America Tour 2019 - 18c and 19c featuesConnor McDonald
 
Neotys PAC 2018 - Stephen Townshend
Neotys PAC 2018 - Stephen TownshendNeotys PAC 2018 - Stephen Townshend
Neotys PAC 2018 - Stephen TownshendNeotys_Partner
 
DevOpsに憧れたAWS初心者が Code3兄弟+Fargateで CI/CD実現したら 社内から賞賛された話
DevOpsに憧れたAWS初心者がCode3兄弟+FargateでCI/CD実現したら社内から賞賛された話DevOpsに憧れたAWS初心者がCode3兄弟+FargateでCI/CD実現したら社内から賞賛された話
DevOpsに憧れたAWS初心者が Code3兄弟+Fargateで CI/CD実現したら 社内から賞賛された話 slideman55
 
Data driven app deploys with chef frontdev
Data driven app deploys with chef frontdevData driven app deploys with chef frontdev
Data driven app deploys with chef frontdevjtimberman
 
Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)
Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)
Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)JEONG HAN Eom
 
M|18 Analytics in the Real World, Case Studies and Use Cases
M|18 Analytics in the Real World, Case Studies and Use CasesM|18 Analytics in the Real World, Case Studies and Use Cases
M|18 Analytics in the Real World, Case Studies and Use CasesMariaDB plc
 
Data-driven model-based restructuring of enterprise transaction operations
Data-driven model-based restructuring of enterprise transaction operationsData-driven model-based restructuring of enterprise transaction operations
Data-driven model-based restructuring of enterprise transaction operationsSudhendu Rai
 
Deep into Prometheus
Deep into PrometheusDeep into Prometheus
Deep into PrometheusZaar Hai
 
BBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data CloudBBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data CloudPatrick Sinclair
 
SRT Prometheus Exporter Introduction.pdf
SRT Prometheus Exporter Introduction.pdfSRT Prometheus Exporter Introduction.pdf
SRT Prometheus Exporter Introduction.pdfTomoya Fujita
 
Sites sps2010
Sites sps2010Sites sps2010
Sites sps2010UGAIA
 
Melbourne Groundbreakers Tour - Hints and Tips
Melbourne Groundbreakers Tour - Hints and TipsMelbourne Groundbreakers Tour - Hints and Tips
Melbourne Groundbreakers Tour - Hints and TipsConnor McDonald
 
ADRecon BH ASIA 2018 : Arsenal Presentation
ADRecon BH ASIA 2018 : Arsenal PresentationADRecon BH ASIA 2018 : Arsenal Presentation
ADRecon BH ASIA 2018 : Arsenal Presentationprashant3535
 
[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...
[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...
[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...Naoki (Neo) SATO
 
Monitoring your electricity usage
Monitoring your electricity usageMonitoring your electricity usage
Monitoring your electricity usageDale Lane
 

Ähnlich wie pg_loader | Nordic PGDay 2018 | Dimitri Fontaine (20)

Ae01 system overview
Ae01 system overviewAe01 system overview
Ae01 system overview
 
18c and 19c features for DBAs
18c and 19c features for DBAs18c and 19c features for DBAs
18c and 19c features for DBAs
 
All AI Roads lead to Distribution - Dot AI
All AI Roads lead to Distribution - Dot AIAll AI Roads lead to Distribution - Dot AI
All AI Roads lead to Distribution - Dot AI
 
Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo
 
ADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs Presentation
ADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs PresentationADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs Presentation
ADRecon BH USA 2018 : Arsenal and DEF CON 26 Demo Labs Presentation
 
Latin America Tour 2019 - 18c and 19c featues
Latin America Tour 2019   - 18c and 19c featuesLatin America Tour 2019   - 18c and 19c featues
Latin America Tour 2019 - 18c and 19c featues
 
Neotys PAC 2018 - Stephen Townshend
Neotys PAC 2018 - Stephen TownshendNeotys PAC 2018 - Stephen Townshend
Neotys PAC 2018 - Stephen Townshend
 
DevOpsに憧れたAWS初心者が Code3兄弟+Fargateで CI/CD実現したら 社内から賞賛された話
DevOpsに憧れたAWS初心者がCode3兄弟+FargateでCI/CD実現したら社内から賞賛された話DevOpsに憧れたAWS初心者がCode3兄弟+FargateでCI/CD実現したら社内から賞賛された話
DevOpsに憧れたAWS初心者が Code3兄弟+Fargateで CI/CD実現したら 社内から賞賛された話
 
Data driven app deploys with chef frontdev
Data driven app deploys with chef frontdevData driven app deploys with chef frontdev
Data driven app deploys with chef frontdev
 
Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)
Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)
Part5.정부지원사업 발표자료(BLT&RoA 미국진출 세미나)
 
M|18 Analytics in the Real World, Case Studies and Use Cases
M|18 Analytics in the Real World, Case Studies and Use CasesM|18 Analytics in the Real World, Case Studies and Use Cases
M|18 Analytics in the Real World, Case Studies and Use Cases
 
Data-driven model-based restructuring of enterprise transaction operations
Data-driven model-based restructuring of enterprise transaction operationsData-driven model-based restructuring of enterprise transaction operations
Data-driven model-based restructuring of enterprise transaction operations
 
Deep into Prometheus
Deep into PrometheusDeep into Prometheus
Deep into Prometheus
 
BBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data CloudBBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data Cloud
 
SRT Prometheus Exporter Introduction.pdf
SRT Prometheus Exporter Introduction.pdfSRT Prometheus Exporter Introduction.pdf
SRT Prometheus Exporter Introduction.pdf
 
Sites sps2010
Sites sps2010Sites sps2010
Sites sps2010
 
Melbourne Groundbreakers Tour - Hints and Tips
Melbourne Groundbreakers Tour - Hints and TipsMelbourne Groundbreakers Tour - Hints and Tips
Melbourne Groundbreakers Tour - Hints and Tips
 
ADRecon BH ASIA 2018 : Arsenal Presentation
ADRecon BH ASIA 2018 : Arsenal PresentationADRecon BH ASIA 2018 : Arsenal Presentation
ADRecon BH ASIA 2018 : Arsenal Presentation
 
[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...
[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...
[Azure Council Experts (ACE) 第22回定例会] Microsoft Azureアップデート情報 (2017/02/17-201...
 
Monitoring your electricity usage
Monitoring your electricity usageMonitoring your electricity usage
Monitoring your electricity usage
 

Mehr von Citus Data

Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...Citus Data
 
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...Citus Data
 
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...Citus Data
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Citus Data
 
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
 
When it all goes wrong | PGConf EU 2019 | Will Leinweber
When it all goes wrong | PGConf EU 2019 | Will LeinweberWhen it all goes wrong | PGConf EU 2019 | Will Leinweber
When it all goes wrong | PGConf EU 2019 | Will LeinweberCitus Data
 
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise GrandjoncAmazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise GrandjoncCitus Data
 
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...Citus Data
 
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff DavisDeep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff DavisCitus Data
 
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...Citus Data
 
A story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
A story on Postgres index types | PostgresLondon 2019 | Louise GrandjoncA story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
A story on Postgres index types | PostgresLondon 2019 | Louise GrandjoncCitus Data
 
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...Citus Data
 
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri FontaineThe Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri FontaineCitus Data
 
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...Citus Data
 
When it all goes wrong (with Postgres) | RailsConf 2019 | Will Leinweber
When it all goes wrong (with Postgres) | RailsConf 2019 | Will LeinweberWhen it all goes wrong (with Postgres) | RailsConf 2019 | Will Leinweber
When it all goes wrong (with Postgres) | RailsConf 2019 | Will LeinweberCitus Data
 
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri FontaineThe Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri FontaineCitus Data
 
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...Citus Data
 
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri FontaineHow to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri FontaineCitus Data
 
When it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
When it all Goes Wrong |Nordic PGDay 2019 | Will LeinweberWhen it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
When it all Goes Wrong |Nordic PGDay 2019 | Will LeinweberCitus Data
 
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire GiordanoWhy PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire GiordanoCitus Data
 

Mehr von Citus Data (20)

Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
Architecting peta-byte-scale analytics by scaling out Postgres on Azure with ...
 
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
Data Modeling, Normalization, and De-Normalization | PostgresOpen 2019 | Dimi...
 
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
 
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
 
When it all goes wrong | PGConf EU 2019 | Will Leinweber
When it all goes wrong | PGConf EU 2019 | Will LeinweberWhen it all goes wrong | PGConf EU 2019 | Will Leinweber
When it all goes wrong | PGConf EU 2019 | Will Leinweber
 
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise GrandjoncAmazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
Amazing SQL your ORM can (or can't) do | PGConf EU 2019 | Louise Grandjonc
 
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
What Microsoft is doing with Postgres & the Citus Data acquisition | PGConf E...
 
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff DavisDeep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
Deep Postgres Extensions in Rust | PGCon 2019 | Jeff Davis
 
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
Why Postgres Why This Database Why Now | SF Bay Area Postgres Meetup | Claire...
 
A story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
A story on Postgres index types | PostgresLondon 2019 | Louise GrandjoncA story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
A story on Postgres index types | PostgresLondon 2019 | Louise Grandjonc
 
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
Why developers need marketing now more than ever | GlueCon 2019 | Claire Gior...
 
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri FontaineThe Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine | Dimitri Fontaine
 
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
Optimizing your app by understanding your Postgres | RailsConf 2019 | Samay S...
 
When it all goes wrong (with Postgres) | RailsConf 2019 | Will Leinweber
When it all goes wrong (with Postgres) | RailsConf 2019 | Will LeinweberWhen it all goes wrong (with Postgres) | RailsConf 2019 | Will Leinweber
When it all goes wrong (with Postgres) | RailsConf 2019 | Will Leinweber
 
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri FontaineThe Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
The Art of PostgreSQL | PostgreSQL Ukraine Meetup | Dimitri Fontaine
 
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
Using Postgres and Citus for Lightning Fast Analytics, also ft. Rollups | Liv...
 
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri FontaineHow to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
 
When it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
When it all Goes Wrong |Nordic PGDay 2019 | Will LeinweberWhen it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
When it all Goes Wrong |Nordic PGDay 2019 | Will Leinweber
 
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire GiordanoWhy PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
Why PostgreSQL Why This Database Why Now | Nordic PGDay 2019 | Claire Giordano
 

Kürzlich hochgeladen

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Kürzlich hochgeladen (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

pg_loader | Nordic PGDay 2018 | Dimitri Fontaine

  • 1. pgloader Nordic pgDay 2018, Oslo Dimitri Fontaine @tapoueh March 13, 2018 Dimitri Fontaine @tapoueh pgloader March 13, 2018 1 / 18
  • 2. Load data into PostgreSQL. Fast. http://pgloader.io/ Dimitri Fontaine @tapoueh pgloader March 13, 2018 2 / 18
  • 3. Load data into PostgreSQL. Fast. http://pgloader.io/ Dimitri Fontaine @tapoueh pgloader March 13, 2018 3 / 18
  • 4. pgloader: Open Source, github https://github.com/dimitri/pgloader Dimitri Fontaine @tapoueh pgloader March 13, 2018 4 / 18
  • 5. File based formats Dimitri Fontaine @tapoueh pgloader March 13, 2018 5 / 18
  • 6. Load from a live connection http://pgloader.io/howto/mysql.html Dimitri Fontaine @tapoueh pgloader March 13, 2018 6 / 18
  • 7. pgloader : Transfom data on the fly http://pgloader.io/ Dimitri Fontaine @tapoueh pgloader March 13, 2018 7 / 18
  • 8. Using a command language LOAD CSV FROM inline (x, y, a, b, c, d) INTO postgresql:///pgloader?csv (a, b, d, c) WITH truncate, skip header = 1, fields optionally enclosed by '"', fields escaped by double-quote, fields terminated by ',' SET work_mem to '12MB', standard_conforming_strings to 'on' Dimitri Fontaine @tapoueh pgloader March 13, 2018 8 / 18
  • 9. with extra before/after sections BEFORE LOAD DO $$ drop table if exists csv; $$, $$ create table csv ( a bigint, b bigint, c char(2), d text ); $$; Dimitri Fontaine @tapoueh pgloader March 13, 2018 9 / 18
  • 10. Some data source examples FROM stdin FROM inline (a, b, c) FROM data/2013_Gaz_113CDs_national.txt FROM FILENAME MATCHING ~/GeoLiteCity-Location.csv/ FROM ALL FILENAMES MATCHING ~/ALIOR/ FROM ALL FILENAMES MATCHING ~/F[A-Z]{4}1[45]|OZ20/ FROM http://www.census.gov/geo/maps-data/ data/docs/gazetteer/places2k.zip FROM http://www.insee.fr/fr/methodes/nomenclatures/ cog/telechargement/2013/dbf/historiq2013.zip Dimitri Fontaine @tapoueh pgloader March 13, 2018 10 / 18
  • 11. On the fly data transformations FROM FILENAME MATCHING ~/GeoLiteCity-Blocks.csv/ WITH ENCODING iso-8859-1 ( startIpNum, endIpNum, locId ) INTO postgresql:///ip4r?geolite.blocks ( iprange ip4r using (ip-range startIpNum endIpNum), locId ) Dimitri Fontaine @tapoueh pgloader March 13, 2018 11 / 18
  • 12. On the fly processing useful for CASTing too Empty string and NULL, default values, zero dates 0000-00-00, int(11), float(20,2), tinyint rather than boolean, sets, ... Oh, and encodings too Dimitri Fontaine @tapoueh pgloader March 13, 2018 12 / 18
  • 13. Here’s how to migrate from MySQL to PostgreSQL In one command line. $ pgloader mysql://user@localhost/sakila pgsql:///pagila Dimitri Fontaine @tapoueh pgloader March 13, 2018 13 / 18
  • 14. pgloader mysql://root@localhost/sakila pgsql:///pagila table name read imported errors total time read write ----------------------------- --------- --------- --------- -------------- --------- --------- before load 3 3 0 0.008s fetch meta data 86 86 0 0.184s create, drop 0 18 0 0.244s ----------------------------- --------- --------- --------- -------------- --------- --------- actor 200 200 0 0.011s 0.021s 0.010s address 603 603 0 0.038s 0.040s 0.037s category 16 16 0 0.007s 0.006s 0.007s city 600 600 0 0.037s 0.034s 0.036s country 109 109 0 0.009s 0.026s 0.009s customer 599 599 0 0.022s 0.077s 0.021s films 1000 1000 0 0.052s 0.097s 0.051s ...... inventory 4581 4581 0 0.057s 0.190s 0.057s language 6 6 0 0.003s 0.011s 0.003s payment 16049 16049 0 0.246s 0.500s 0.245s rental 16044 16044 0 0.329s 0.623s 0.329s staff 2 2 0 0.025s 0.007s 0.025s store 2 2 0 0.094s 0.010s 0.094s actor_info 200 200 0 0.013s 1.020s 0.012s mv.customer_list 599 599 0 0.022s 0.047s 0.022s mv.film_list 997 997 0 0.046s 0.172s 0.046s ----------------------------- --------- --------- --------- -------------- --------- --------- COPY Threads Completion 69 69 0 2.076s Create Indexes 41 41 0 0.489s Index Build Completion 41 41 0 0.002s Reset Sequences 0 13 0 0.030s Primary Keys 16 16 0 0.018s Foreign Keys 22 44 0 0.156s Install comments 0 0 0 0.000s ----------------------------- --------- --------- --------- -------------- --------- --------- Total import time 50086 50086 0 2.788s 3.572s 1.151s Dimitri Fontaine @tapoueh pgloader March 13, 2018 14 / 18
  • 15. And more to come File formats with on-the-fly normalisation Dimitri Fontaine @tapoueh pgloader March 13, 2018 15 / 18
  • 16. Other database systems Dimitri Fontaine @tapoueh pgloader March 13, 2018 16 / 18
  • 17. You can become a sponsor! http://pgloader.io/pgloader-moral-license.html Dimitri Fontaine @tapoueh pgloader March 13, 2018 17 / 18
  • 18. Load data into PostgreSQL. Fast. http://pgloader.io/ Dimitri Fontaine @tapoueh pgloader March 13, 2018 18 / 18