SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
POSTGRESQL CHEZ LENGOW
Quand un poney rencontre un éléphant
Mickael Le Baillif, Guillaume Stoffer
Meetup PostgreSQL Nantes #2
2016-04-26
NOTRE METIER
2
NOTRE
METIER
3
Lengow : Un écosystème dédié au e-commerce
NOS BESOINS
EN BDD
4
NOS
BESOINS EN
BDD
 Un très grand volume de
données estimé à 250
milliards de produits indexés
par an
 Une très grande diversité
des sources en entrée
(langage, format, structure)
5
NOS
BESOINS EN
BDD
 Une très grande diversité
des diffuseurs en sortie
(format attendu exotique)
 La possibilité de manipuler
un catalogue marchand en
profondeur en toute sécurité
6
ARCHITECTURE
POSTGRESQL
7
QU’Y A-
T-IL
SOUS LE
CAPOT ?
ARCHITECTURE
MATERIELLE
9
Serveur physique
ARCHITECTURE
MATERIELLE
10
Processeurs
multi-coeurs
ARCHITECTURE
MATERIELLE
11
Données “chaudes”
intégralement en RAM
ARCHITECTURE
MATERIELLE
12
Persistence disque
sur SSD
ET SI ÇA
CRASHE
?
RÉPLICATION
ET HAUTE
DISPONIBILITÉ
14
Datacenter 1 Datacenter 2
WAL shipping
WALshipping
WALshipping
RÉPLICATION
ET HAUTE
DISPONIBILITÉ
15
@IP virtuelle RW
@IP virtuelle RO
ARCHITECTURE
LOGIQUE
16
JSONB
XML
CSV
JSON
…
XML
CSV
JSON
Marchands
Diffuseurs
IMPLÉMENTATIONS
INTÉRESSANTES
17
XML ET
XPATH
18
Extraction de données utiles
dans des documents XML
directement à partir de
requêtes SQL
XML ET
XPATH
19 La structure du fichier à envoyer aux diffuseurs est
spécifiée en XML
<?xml version="1.0" encoding="UTF-8"?>
<group name="Product" foreach="product" main_products_node="true">
<csv_param name="delimiter" value="|" />
<csv_param name="quotechar" value="" />
<field id="1" type="string" use="required" name="EAN"/>
<field id="2" type="string" use="required" name="Titre"/>
<field id="3" type="string" use="required" name="Marque"/>
<field id="4" type="string" use="required" name="Prix HT"/>
<field id="5" type="string" use="required" name="Prix TTC"/>
<field id="6" type="string" use="required" name="Frais port"/>
</group>
XML ET
XPATH
20 La structure du fichier à envoyer aux diffuseurs est
spécifiée en XML
<?xml version="1.0" encoding="UTF-8"?>
<group name="Product" foreach="product" main_products_node="true">
<csv_param name="delimiter" value="|" />
<csv_param name="quotechar" value="" />
<field id="1" type="string" use="required" name="EAN"/>
<field id="2" type="string" use="required" name="Titre"/>
<field id="3" type="string" use="required" name="Marque"/>
<field id="4" type="string" use="required" name="Prix HT"/>
<field id="5" type="string" use="required" name="Prix TTC"/>
<field id="6" type="string" use="required" name="Frais port"/>
</group>
JSON
EAN Titre Marqu
e
Prix HT Prix
TTC
Frais
port
[
{
"EAN": "...",
"Titre": "...",
"Marque": "...",
"Prix HT": 2,
"Prix TTC": 3,
"Frais port": 1
}
]
<?xml version="1.0" encoding="UTF-8"?>
<Products>
<Product>
<EAN>...</EAN>
<Titre>...</Titre>
<Marque>...</Marque>
<Prix_HT>...</Prix_HT>
<Prix_TTC>...</Prix_TTC>
<Frais_port>...</Frais_port>
</Product>
</Products>
XML ET
XPATH
21
XML ET
XPATH
22
<?xml version="1.0" encoding="UTF-8"?>
<group name="Product" foreach="product" main_products_node="true">
<csv_param name="delimiter" value="|" />
<csv_param name="quotechar" value="" />
<field id="1" type="string" use="required" name="EAN"/>
<field id="2" type="string" use="required" name="Titre"/>
<field id="3" type="string" use="required" name="Marque"/>
<field id="4" type="string" use="required" name="Prix HT"/>
<field id="5" type="string" use="required" name="Prix TTC"/>
<field id="6" type="string" use="required" name="Frais port"/>
</group>
WITH fields AS
(SELECT unnest(xpath('//field', schema_definition)) AS f
FROM channel.structure
WHERE id = 915)
SELECT unnest(xpath('@id', f)) AS id,
unnest(xpath('@name', f)) AS name,
unnest(xpath('@use', f))::text = 'required' AS required
FROM fields
XML ET
XPATH
23
<?xml version="1.0" encoding="UTF-8"?>
<group name="Product" foreach="product" main_products_node="true">
<csv_param name="delimiter" value="|" />
<csv_param name="quotechar" value="" />
<field id="1" type="string" use="required" name="EAN"/>
<field id="2" type="string" use="required" name="Titre"/>
<field id="3" type="string" use="required" name="Marque"/>
<field id="4" type="string" use="required" name="Prix HT"/>
<field id="5" type="string" use="required" name="Prix TTC"/>
<field id="6" type="string" use="required" name="Frais port"/>
</group>
WITH fields AS
(SELECT unnest(xpath('//field', schema_definition)) AS f
FROM channel.structure
WHERE id = 915)
SELECT unnest(xpath('@id', f)) AS id,
unnest(xpath('@name', f)) AS name,
unnest(xpath('@use', f))::text = 'required' AS required
FROM fields
f
<field id="1" type="string" use="required" name="EAN"/>
<field id="2" type="string" use="required" name="Titre Produit"/>
<field id="3" type="string" use="required" name="Marque"/>
<field id="4" type="string" use="required" name="Prix HT"/>
XML ET
XPATH
24
<?xml version="1.0" encoding="UTF-8"?>
<group name="Product" foreach="product" main_products_node="true">
<csv_param name="delimiter" value="|" />
<csv_param name="quotechar" value="" />
<field id="1" type="string" use="required" name="EAN"/>
<field id="2" type="string" use="required" name="Titre"/>
<field id="3" type="string" use="required" name="Marque"/>
<field id="4" type="string" use="required" name="Prix HT"/>
<field id="5" type="string" use="required" name="Prix TTC"/>
<field id="6" type="string" use="required" name="Frais port"/>
</group>
WITH fields AS
(SELECT unnest(xpath('//field', schema_definition)) AS f
FROM channel.structure
WHERE id = 915)
SELECT unnest(xpath('@id', f)) AS id,
unnest(xpath('@name', f)) AS name,
unnest(xpath('@use', f))::text = 'required' AS required
FROM fields
id name required
1 EAN t
2 Titre Produit t
3 Marque t
4 Prix HT t
SYSTEM
VERSION
25
 Standard SQL 2011
 Extension Temporal Tables
 Procédure versioning()
 Colonne type tstzrange
 Synergie avec l'héritage de
table
26
Utilisation de triggers pour
indexer les champs essentiels
dans du contenu JSON
TRIGGERS
D’INDEXATION
TRIGGERS
D’INDEXATION
27
Cas traditionnel : données structurées
SKU name price stock color
99_B33W Blue Shoes 64.99 6 blue
54_A23B Umbrella 19.99 55 black
11_R22F AiePhone 45.55 1200 white
98_N26T Chair 63.00 8 null
TRIGGERS
D’INDEXATION
28
Stockage JSON : données fusionnées
dans une seule colonne
id attributes
101 {‘SKU’: ’99_B33W’, ‘name’: ‘Blue Shoes’, ’price’: 64.99 …}
106 {‘SKU’: ’54_A23B’, ‘name’: ‘Umbrella’, ’price’: 19.99 …}
115 {‘SKU’: ’11_R22F’, ‘name’: ‘AiePhone’, ’price’: 45.55 …}
132 {‘SKU’: ’98_N26T’, ‘name’: ‘Chair’, ’price’: 63 …}
SKU name price stock color
99_B33W Blue Shoes 64.99 6 blue
54_A23B Umbrella 19.99 55 black
11_R22F AiePhone 45.55 1200 white
98_N26T Chair 63.00 8 null
TRIGGERS
D’INDEXATION
29
catalog_198
id_catalog mapping
198 {‘id’: ‘SKU’, ‘prix’: ‘price’, ‘titre’: ‘name’, … }
catalog_format
CREATE TRIGGER xxx after INSERT
OR UPDATE OF mapping
ON catalog_format
id attributes
101 {‘SKU’: ’99_B33W’, ‘name’: ‘Blue Shoes’, ’price’: 64.99 …}
106 {‘SKU’: ’54_A23B’, ‘name’: ‘Umbrella’, ’price’: 19.99 …}
115 {‘SKU’: ’11_R22F’, ‘name’: ‘AiePhone’, ’price’: 45.55 …}
132 {‘SKU’: ’98_N26T’, ‘name’: ‘Chair’, ’price’: 63 …}
create index on catalog_198
using btree(attributes->>’SKU’)
TRIGGERS
D’INDEXATION
30
create index on catalog_198
using GIN (attributes)
Va indexer toutes les propriétés d’un produit, trop
volumineux et coûteux
SELECT attributes
FROM catalog_198
WHERE attributes @> ’{"SKU”: "54_A23B”}’
catalog_198
id attributes
101 {‘SKU’: ’99_B33W’, ‘name’: ‘Blue Shoes’, ’price’: 64.99 …}
106 {‘SKU’: ’54_A23B’, ‘name’: ‘Umbrella’, ’price’: 19.99 …}
115 {‘SKU’: ’11_R22F’, ‘name’: ‘AiePhone’, ’price’: 45.55 …}
132 {‘SKU’: ’98_N26T’, ‘name’: ‘Chair’, ’price’: 63 …}
ET POUR
PLUS TARD …
31
PROJETS
FUTURS
▸Création d'index asynchrone avec
PGQ
▹Ne pas bloquer lors du changement de
mapping d’un catalogue
▸Parallélisation des requêtes sur nos
4 serveurs (Citus DB ?)
▹Chaque serveur peut scanner ¼ de la table
▸TABLESAMPLE + cache
▹Estimer très rapidement un résultat sur un
échantillon, puis lancer le calcul complet qui
sera mis en cache
32
MERCI
MERCI
Des questions ?
Contact :
 mickael.le.baillif@gmail.com
 guillaume.stoffer@gmail.com

Contenu connexe

En vedette

Amen.fr - Webinar avec l'Afnic : Nouveaux GTLD
Amen.fr - Webinar avec l'Afnic : Nouveaux GTLDAmen.fr - Webinar avec l'Afnic : Nouveaux GTLD
Amen.fr - Webinar avec l'Afnic : Nouveaux GTLDAmen.fr
 
Les applications iOS (iPhone & iPad) et Android
Les applications iOS (iPhone & iPad) et AndroidLes applications iOS (iPhone & iPad) et Android
Les applications iOS (iPhone & iPad) et AndroidNeedeo
 
I tourisme amen donuts webinar july 15
I tourisme amen donuts webinar july 15I tourisme amen donuts webinar july 15
I tourisme amen donuts webinar july 15Amen.fr
 
Découvrez le nouveau plugin pour la solution ecommerce Shopware
Découvrez le nouveau plugin pour la solution ecommerce ShopwareDécouvrez le nouveau plugin pour la solution ecommerce Shopware
Découvrez le nouveau plugin pour la solution ecommerce ShopwareLengow
 
présentation wordpress
présentation wordpressprésentation wordpress
présentation wordpressmonsieurpixel
 
Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...
Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...
Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...polenumerique33
 
Stratégie Product Listing Ads Google AdWords (2013)
Stratégie Product Listing Ads Google AdWords (2013)Stratégie Product Listing Ads Google AdWords (2013)
Stratégie Product Listing Ads Google AdWords (2013)Damien Marchois
 
IAB European Agency Snapshot Study
IAB European Agency Snapshot StudyIAB European Agency Snapshot Study
IAB European Agency Snapshot Studypolenumerique33
 
Comment choisir son nom de domaine avec Amen
Comment choisir son nom de domaine avec AmenComment choisir son nom de domaine avec Amen
Comment choisir son nom de domaine avec AmenAmen.fr
 
Amen.fr - Afnic Nouveaux GTLD
Amen.fr - Afnic Nouveaux GTLDAmen.fr - Afnic Nouveaux GTLD
Amen.fr - Afnic Nouveaux GTLDAmen.fr
 
Bien débuter avec une plateforme e-commerce
Bien débuter avec une plateforme e-commerceBien débuter avec une plateforme e-commerce
Bien débuter avec une plateforme e-commerceEnzo
 
Adobe Digital Index "Best of the Best Benchmark 2014"
Adobe Digital Index "Best of the Best Benchmark 2014"Adobe Digital Index "Best of the Best Benchmark 2014"
Adobe Digital Index "Best of the Best Benchmark 2014"polenumerique33
 
Amen - Introduction au référencement (SEO)
Amen - Introduction au référencement (SEO)Amen - Introduction au référencement (SEO)
Amen - Introduction au référencement (SEO)Amen.fr
 
Conseils et outils gratuits pour démarrer
Conseils et outils gratuits pour démarrer Conseils et outils gratuits pour démarrer
Conseils et outils gratuits pour démarrer Needeo
 
Améliorez votre présence en ligne pour attirer vos clients
Améliorez votre présence en ligne pour attirer vos clientsAméliorez votre présence en ligne pour attirer vos clients
Améliorez votre présence en ligne pour attirer vos clientspolenumerique33
 
Amen et l'Afnic : Choisir son adresse internet.
Amen et l'Afnic : Choisir son adresse internet.Amen et l'Afnic : Choisir son adresse internet.
Amen et l'Afnic : Choisir son adresse internet.Amen.fr
 

En vedette (18)

Amen.fr - Webinar avec l'Afnic : Nouveaux GTLD
Amen.fr - Webinar avec l'Afnic : Nouveaux GTLDAmen.fr - Webinar avec l'Afnic : Nouveaux GTLD
Amen.fr - Webinar avec l'Afnic : Nouveaux GTLD
 
Les applications iOS (iPhone & iPad) et Android
Les applications iOS (iPhone & iPad) et AndroidLes applications iOS (iPhone & iPad) et Android
Les applications iOS (iPhone & iPad) et Android
 
I tourisme amen donuts webinar july 15
I tourisme amen donuts webinar july 15I tourisme amen donuts webinar july 15
I tourisme amen donuts webinar july 15
 
Découvrez le nouveau plugin pour la solution ecommerce Shopware
Découvrez le nouveau plugin pour la solution ecommerce ShopwareDécouvrez le nouveau plugin pour la solution ecommerce Shopware
Découvrez le nouveau plugin pour la solution ecommerce Shopware
 
présentation wordpress
présentation wordpressprésentation wordpress
présentation wordpress
 
Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...
Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...
Optimisez votre référencement sur Internet pour améliorer la visibilité de vo...
 
Stratégie Product Listing Ads Google AdWords (2013)
Stratégie Product Listing Ads Google AdWords (2013)Stratégie Product Listing Ads Google AdWords (2013)
Stratégie Product Listing Ads Google AdWords (2013)
 
Initiation html css
Initiation html cssInitiation html css
Initiation html css
 
Lecture 03 HTML&CSS Part 2
Lecture 03   HTML&CSS Part 2Lecture 03   HTML&CSS Part 2
Lecture 03 HTML&CSS Part 2
 
IAB European Agency Snapshot Study
IAB European Agency Snapshot StudyIAB European Agency Snapshot Study
IAB European Agency Snapshot Study
 
Comment choisir son nom de domaine avec Amen
Comment choisir son nom de domaine avec AmenComment choisir son nom de domaine avec Amen
Comment choisir son nom de domaine avec Amen
 
Amen.fr - Afnic Nouveaux GTLD
Amen.fr - Afnic Nouveaux GTLDAmen.fr - Afnic Nouveaux GTLD
Amen.fr - Afnic Nouveaux GTLD
 
Bien débuter avec une plateforme e-commerce
Bien débuter avec une plateforme e-commerceBien débuter avec une plateforme e-commerce
Bien débuter avec une plateforme e-commerce
 
Adobe Digital Index "Best of the Best Benchmark 2014"
Adobe Digital Index "Best of the Best Benchmark 2014"Adobe Digital Index "Best of the Best Benchmark 2014"
Adobe Digital Index "Best of the Best Benchmark 2014"
 
Amen - Introduction au référencement (SEO)
Amen - Introduction au référencement (SEO)Amen - Introduction au référencement (SEO)
Amen - Introduction au référencement (SEO)
 
Conseils et outils gratuits pour démarrer
Conseils et outils gratuits pour démarrer Conseils et outils gratuits pour démarrer
Conseils et outils gratuits pour démarrer
 
Améliorez votre présence en ligne pour attirer vos clients
Améliorez votre présence en ligne pour attirer vos clientsAméliorez votre présence en ligne pour attirer vos clients
Améliorez votre présence en ligne pour attirer vos clients
 
Amen et l'Afnic : Choisir son adresse internet.
Amen et l'Afnic : Choisir son adresse internet.Amen et l'Afnic : Choisir son adresse internet.
Amen et l'Afnic : Choisir son adresse internet.
 

Similaire à Utilisation de PostgreSQL chez Lengow

Telecharger Exercices corrigés sqlplus
Telecharger Exercices corrigés sqlplusTelecharger Exercices corrigés sqlplus
Telecharger Exercices corrigés sqlpluswebreaker
 
Introduction à Angular JS
Introduction à Angular JSIntroduction à Angular JS
Introduction à Angular JSAntoine Rey
 
Journées ABES 2014 - Focus sur la plateforme Istex
Journées ABES 2014 - Focus sur la plateforme IstexJournées ABES 2014 - Focus sur la plateforme Istex
Journées ABES 2014 - Focus sur la plateforme IstexABES
 
Oxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overviewOxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overviewLudovic Piot
 
Oxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic SearchOxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic SearchOxalide
 
Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014Silicon Comté
 
Principes Relationnels et Concepts Oracle
Principes Relationnelset Concepts OraclePrincipes Relationnelset Concepts Oracle
Principes Relationnels et Concepts Oraclewebreaker
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab ElasticsearchDavid Pilato
 
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -introNosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -introOlivier Mallassi
 
Construisez votre première application MongoDB
Construisez votre première application MongoDBConstruisez votre première application MongoDB
Construisez votre première application MongoDBMongoDB
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLHervé Leclerc
 
Slides de la Localisation
Slides de la LocalisationSlides de la Localisation
Slides de la LocalisationCocoaHeads.fr
 
Digital GraphTour Paris - Neo4j 4.0, les nouveautés
Digital GraphTour Paris - Neo4j 4.0, les nouveautésDigital GraphTour Paris - Neo4j 4.0, les nouveautés
Digital GraphTour Paris - Neo4j 4.0, les nouveautésNeo4j
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudriaDavid Pilato
 
SdE 2 - Langage C, Allocation de memoire
SdE 2 - Langage C, Allocation de memoireSdE 2 - Langage C, Allocation de memoire
SdE 2 - Langage C, Allocation de memoireAlexandru Radovici
 

Similaire à Utilisation de PostgreSQL chez Lengow (20)

Chapitre 2
Chapitre 2Chapitre 2
Chapitre 2
 
Telecharger Exercices corrigés sqlplus
Telecharger Exercices corrigés sqlplusTelecharger Exercices corrigés sqlplus
Telecharger Exercices corrigés sqlplus
 
Introduction à Angular JS
Introduction à Angular JSIntroduction à Angular JS
Introduction à Angular JS
 
Journées ABES 2014 - Focus sur la plateforme Istex
Journées ABES 2014 - Focus sur la plateforme IstexJournées ABES 2014 - Focus sur la plateforme Istex
Journées ABES 2014 - Focus sur la plateforme Istex
 
Adopte une BDD
Adopte une BDDAdopte une BDD
Adopte une BDD
 
Oxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overviewOxalide Workshop #3 - Elasticearch, an overview
Oxalide Workshop #3 - Elasticearch, an overview
 
Oxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic SearchOxalide Academy : Workshop #3 Elastic Search
Oxalide Academy : Workshop #3 Elastic Search
 
Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014
 
Principes Relationnels et Concepts Oracle
Principes Relationnelset Concepts OraclePrincipes Relationnelset Concepts Oracle
Principes Relationnels et Concepts Oracle
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab Elasticsearch
 
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -introNosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
Nosql, hadoop, map reduce, hbase, sqoop, voldemort, cassandra -intro
 
Pg jsonb format 16-9
Pg jsonb format 16-9Pg jsonb format 16-9
Pg jsonb format 16-9
 
Hello mongo
Hello mongoHello mongo
Hello mongo
 
Construisez votre première application MongoDB
Construisez votre première application MongoDBConstruisez votre première application MongoDB
Construisez votre première application MongoDB
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQL
 
Slides de la Localisation
Slides de la LocalisationSlides de la Localisation
Slides de la Localisation
 
Digital GraphTour Paris - Neo4j 4.0, les nouveautés
Digital GraphTour Paris - Neo4j 4.0, les nouveautésDigital GraphTour Paris - Neo4j 4.0, les nouveautés
Digital GraphTour Paris - Neo4j 4.0, les nouveautés
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudria
 
cm-bd.pdf
cm-bd.pdfcm-bd.pdf
cm-bd.pdf
 
SdE 2 - Langage C, Allocation de memoire
SdE 2 - Langage C, Allocation de memoireSdE 2 - Langage C, Allocation de memoire
SdE 2 - Langage C, Allocation de memoire
 

Plus de Lengow

Lengow und Fulfillment
Lengow und FulfillmentLengow und Fulfillment
Lengow und FulfillmentLengow
 
Lengow and the Fulfillment
Lengow and the FulfillmentLengow and the Fulfillment
Lengow and the FulfillmentLengow
 
Lengow et le Fulfillment
Lengow et le FulfillmentLengow et le Fulfillment
Lengow et le FulfillmentLengow
 
Amazon top errors and how to fix it with Lengow
Amazon top errors and how to fix it with LengowAmazon top errors and how to fix it with Lengow
Amazon top errors and how to fix it with LengowLengow
 
Résoudre les erreurs Amazon Marketplace avec Lengow
Résoudre les erreurs Amazon Marketplace avec LengowRésoudre les erreurs Amazon Marketplace avec Lengow
Résoudre les erreurs Amazon Marketplace avec LengowLengow
 
Travaillez la visibilité de votre marque avec Google Manufacturer Center
Travaillez la visibilité de votre marque avec Google Manufacturer CenterTravaillez la visibilité de votre marque avec Google Manufacturer Center
Travaillez la visibilité de votre marque avec Google Manufacturer CenterLengow
 
Increase Your Brand’s Visibility with Google Manufacturer Center
Increase Your Brand’s Visibility with Google Manufacturer Center Increase Your Brand’s Visibility with Google Manufacturer Center
Increase Your Brand’s Visibility with Google Manufacturer Center Lengow
 
Amazon Vendor Central vs Amazon Seller Central
Amazon Vendor Central vs Amazon Seller Central Amazon Vendor Central vs Amazon Seller Central
Amazon Vendor Central vs Amazon Seller Central Lengow
 
Vendre sur Cdiscount Pro avec Lengow
Vendre sur Cdiscount Pro avec Lengow Vendre sur Cdiscount Pro avec Lengow
Vendre sur Cdiscount Pro avec Lengow Lengow
 
Google Local Inventory Ads and Web-to-Store strategy
Google Local Inventory Ads and Web-to-Store strategyGoogle Local Inventory Ads and Web-to-Store strategy
Google Local Inventory Ads and Web-to-Store strategyLengow
 
Google Local Inventory Ads et Web-to-Store
Google Local Inventory Ads et Web-to-StoreGoogle Local Inventory Ads et Web-to-Store
Google Local Inventory Ads et Web-to-StoreLengow
 
A/B Testing pour Google Shopping avec Lengow
A/B Testing pour Google Shopping avec LengowA/B Testing pour Google Shopping avec Lengow
A/B Testing pour Google Shopping avec LengowLengow
 
Plugins for Ecommerce platforms
Plugins for Ecommerce platformsPlugins for Ecommerce platforms
Plugins for Ecommerce platformsLengow
 
[Infographic] 5 tips to help you start using Facebook Dynamic Ads
[Infographic] 5 tips to help you start using Facebook Dynamic Ads[Infographic] 5 tips to help you start using Facebook Dynamic Ads
[Infographic] 5 tips to help you start using Facebook Dynamic AdsLengow
 
[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic Ads
[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic Ads[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic Ads
[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic AdsLengow
 
The E-commerce Euros: France - Portugal
The E-commerce Euros: France - PortugalThe E-commerce Euros: France - Portugal
The E-commerce Euros: France - PortugalLengow
 
Championnats d’Europe du e-commerce : France - Portugal
Championnats d’Europe du e-commerce : France - PortugalChampionnats d’Europe du e-commerce : France - Portugal
Championnats d’Europe du e-commerce : France - PortugalLengow
 
The E-commerce Euros: France - Germany
The E-commerce Euros: France - GermanyThe E-commerce Euros: France - Germany
The E-commerce Euros: France - GermanyLengow
 
Championnats d’Europe du e-commerce
Championnats d’Europe du e-commerceChampionnats d’Europe du e-commerce
Championnats d’Europe du e-commerceLengow
 
The E-commerce Euros: Germany - Italy
The E-commerce Euros: Germany - ItalyThe E-commerce Euros: Germany - Italy
The E-commerce Euros: Germany - ItalyLengow
 

Plus de Lengow (20)

Lengow und Fulfillment
Lengow und FulfillmentLengow und Fulfillment
Lengow und Fulfillment
 
Lengow and the Fulfillment
Lengow and the FulfillmentLengow and the Fulfillment
Lengow and the Fulfillment
 
Lengow et le Fulfillment
Lengow et le FulfillmentLengow et le Fulfillment
Lengow et le Fulfillment
 
Amazon top errors and how to fix it with Lengow
Amazon top errors and how to fix it with LengowAmazon top errors and how to fix it with Lengow
Amazon top errors and how to fix it with Lengow
 
Résoudre les erreurs Amazon Marketplace avec Lengow
Résoudre les erreurs Amazon Marketplace avec LengowRésoudre les erreurs Amazon Marketplace avec Lengow
Résoudre les erreurs Amazon Marketplace avec Lengow
 
Travaillez la visibilité de votre marque avec Google Manufacturer Center
Travaillez la visibilité de votre marque avec Google Manufacturer CenterTravaillez la visibilité de votre marque avec Google Manufacturer Center
Travaillez la visibilité de votre marque avec Google Manufacturer Center
 
Increase Your Brand’s Visibility with Google Manufacturer Center
Increase Your Brand’s Visibility with Google Manufacturer Center Increase Your Brand’s Visibility with Google Manufacturer Center
Increase Your Brand’s Visibility with Google Manufacturer Center
 
Amazon Vendor Central vs Amazon Seller Central
Amazon Vendor Central vs Amazon Seller Central Amazon Vendor Central vs Amazon Seller Central
Amazon Vendor Central vs Amazon Seller Central
 
Vendre sur Cdiscount Pro avec Lengow
Vendre sur Cdiscount Pro avec Lengow Vendre sur Cdiscount Pro avec Lengow
Vendre sur Cdiscount Pro avec Lengow
 
Google Local Inventory Ads and Web-to-Store strategy
Google Local Inventory Ads and Web-to-Store strategyGoogle Local Inventory Ads and Web-to-Store strategy
Google Local Inventory Ads and Web-to-Store strategy
 
Google Local Inventory Ads et Web-to-Store
Google Local Inventory Ads et Web-to-StoreGoogle Local Inventory Ads et Web-to-Store
Google Local Inventory Ads et Web-to-Store
 
A/B Testing pour Google Shopping avec Lengow
A/B Testing pour Google Shopping avec LengowA/B Testing pour Google Shopping avec Lengow
A/B Testing pour Google Shopping avec Lengow
 
Plugins for Ecommerce platforms
Plugins for Ecommerce platformsPlugins for Ecommerce platforms
Plugins for Ecommerce platforms
 
[Infographic] 5 tips to help you start using Facebook Dynamic Ads
[Infographic] 5 tips to help you start using Facebook Dynamic Ads[Infographic] 5 tips to help you start using Facebook Dynamic Ads
[Infographic] 5 tips to help you start using Facebook Dynamic Ads
 
[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic Ads
[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic Ads[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic Ads
[Infographie] Nos conseils pour bien vous lancer avec les Facebook Dynamic Ads
 
The E-commerce Euros: France - Portugal
The E-commerce Euros: France - PortugalThe E-commerce Euros: France - Portugal
The E-commerce Euros: France - Portugal
 
Championnats d’Europe du e-commerce : France - Portugal
Championnats d’Europe du e-commerce : France - PortugalChampionnats d’Europe du e-commerce : France - Portugal
Championnats d’Europe du e-commerce : France - Portugal
 
The E-commerce Euros: France - Germany
The E-commerce Euros: France - GermanyThe E-commerce Euros: France - Germany
The E-commerce Euros: France - Germany
 
Championnats d’Europe du e-commerce
Championnats d’Europe du e-commerceChampionnats d’Europe du e-commerce
Championnats d’Europe du e-commerce
 
The E-commerce Euros: Germany - Italy
The E-commerce Euros: Germany - ItalyThe E-commerce Euros: Germany - Italy
The E-commerce Euros: Germany - Italy
 

Utilisation de PostgreSQL chez Lengow

  • 1. POSTGRESQL CHEZ LENGOW Quand un poney rencontre un éléphant Mickael Le Baillif, Guillaume Stoffer Meetup PostgreSQL Nantes #2 2016-04-26
  • 3. NOTRE METIER 3 Lengow : Un écosystème dédié au e-commerce
  • 5. NOS BESOINS EN BDD  Un très grand volume de données estimé à 250 milliards de produits indexés par an  Une très grande diversité des sources en entrée (langage, format, structure) 5
  • 6. NOS BESOINS EN BDD  Une très grande diversité des diffuseurs en sortie (format attendu exotique)  La possibilité de manipuler un catalogue marchand en profondeur en toute sécurité 6
  • 14. RÉPLICATION ET HAUTE DISPONIBILITÉ 14 Datacenter 1 Datacenter 2 WAL shipping WALshipping WALshipping
  • 18. XML ET XPATH 18 Extraction de données utiles dans des documents XML directement à partir de requêtes SQL
  • 19. XML ET XPATH 19 La structure du fichier à envoyer aux diffuseurs est spécifiée en XML <?xml version="1.0" encoding="UTF-8"?> <group name="Product" foreach="product" main_products_node="true"> <csv_param name="delimiter" value="|" /> <csv_param name="quotechar" value="" /> <field id="1" type="string" use="required" name="EAN"/> <field id="2" type="string" use="required" name="Titre"/> <field id="3" type="string" use="required" name="Marque"/> <field id="4" type="string" use="required" name="Prix HT"/> <field id="5" type="string" use="required" name="Prix TTC"/> <field id="6" type="string" use="required" name="Frais port"/> </group>
  • 20. XML ET XPATH 20 La structure du fichier à envoyer aux diffuseurs est spécifiée en XML <?xml version="1.0" encoding="UTF-8"?> <group name="Product" foreach="product" main_products_node="true"> <csv_param name="delimiter" value="|" /> <csv_param name="quotechar" value="" /> <field id="1" type="string" use="required" name="EAN"/> <field id="2" type="string" use="required" name="Titre"/> <field id="3" type="string" use="required" name="Marque"/> <field id="4" type="string" use="required" name="Prix HT"/> <field id="5" type="string" use="required" name="Prix TTC"/> <field id="6" type="string" use="required" name="Frais port"/> </group> JSON EAN Titre Marqu e Prix HT Prix TTC Frais port [ { "EAN": "...", "Titre": "...", "Marque": "...", "Prix HT": 2, "Prix TTC": 3, "Frais port": 1 } ] <?xml version="1.0" encoding="UTF-8"?> <Products> <Product> <EAN>...</EAN> <Titre>...</Titre> <Marque>...</Marque> <Prix_HT>...</Prix_HT> <Prix_TTC>...</Prix_TTC> <Frais_port>...</Frais_port> </Product> </Products>
  • 22. XML ET XPATH 22 <?xml version="1.0" encoding="UTF-8"?> <group name="Product" foreach="product" main_products_node="true"> <csv_param name="delimiter" value="|" /> <csv_param name="quotechar" value="" /> <field id="1" type="string" use="required" name="EAN"/> <field id="2" type="string" use="required" name="Titre"/> <field id="3" type="string" use="required" name="Marque"/> <field id="4" type="string" use="required" name="Prix HT"/> <field id="5" type="string" use="required" name="Prix TTC"/> <field id="6" type="string" use="required" name="Frais port"/> </group> WITH fields AS (SELECT unnest(xpath('//field', schema_definition)) AS f FROM channel.structure WHERE id = 915) SELECT unnest(xpath('@id', f)) AS id, unnest(xpath('@name', f)) AS name, unnest(xpath('@use', f))::text = 'required' AS required FROM fields
  • 23. XML ET XPATH 23 <?xml version="1.0" encoding="UTF-8"?> <group name="Product" foreach="product" main_products_node="true"> <csv_param name="delimiter" value="|" /> <csv_param name="quotechar" value="" /> <field id="1" type="string" use="required" name="EAN"/> <field id="2" type="string" use="required" name="Titre"/> <field id="3" type="string" use="required" name="Marque"/> <field id="4" type="string" use="required" name="Prix HT"/> <field id="5" type="string" use="required" name="Prix TTC"/> <field id="6" type="string" use="required" name="Frais port"/> </group> WITH fields AS (SELECT unnest(xpath('//field', schema_definition)) AS f FROM channel.structure WHERE id = 915) SELECT unnest(xpath('@id', f)) AS id, unnest(xpath('@name', f)) AS name, unnest(xpath('@use', f))::text = 'required' AS required FROM fields f <field id="1" type="string" use="required" name="EAN"/> <field id="2" type="string" use="required" name="Titre Produit"/> <field id="3" type="string" use="required" name="Marque"/> <field id="4" type="string" use="required" name="Prix HT"/>
  • 24. XML ET XPATH 24 <?xml version="1.0" encoding="UTF-8"?> <group name="Product" foreach="product" main_products_node="true"> <csv_param name="delimiter" value="|" /> <csv_param name="quotechar" value="" /> <field id="1" type="string" use="required" name="EAN"/> <field id="2" type="string" use="required" name="Titre"/> <field id="3" type="string" use="required" name="Marque"/> <field id="4" type="string" use="required" name="Prix HT"/> <field id="5" type="string" use="required" name="Prix TTC"/> <field id="6" type="string" use="required" name="Frais port"/> </group> WITH fields AS (SELECT unnest(xpath('//field', schema_definition)) AS f FROM channel.structure WHERE id = 915) SELECT unnest(xpath('@id', f)) AS id, unnest(xpath('@name', f)) AS name, unnest(xpath('@use', f))::text = 'required' AS required FROM fields id name required 1 EAN t 2 Titre Produit t 3 Marque t 4 Prix HT t
  • 25. SYSTEM VERSION 25  Standard SQL 2011  Extension Temporal Tables  Procédure versioning()  Colonne type tstzrange  Synergie avec l'héritage de table
  • 26. 26 Utilisation de triggers pour indexer les champs essentiels dans du contenu JSON TRIGGERS D’INDEXATION
  • 27. TRIGGERS D’INDEXATION 27 Cas traditionnel : données structurées SKU name price stock color 99_B33W Blue Shoes 64.99 6 blue 54_A23B Umbrella 19.99 55 black 11_R22F AiePhone 45.55 1200 white 98_N26T Chair 63.00 8 null
  • 28. TRIGGERS D’INDEXATION 28 Stockage JSON : données fusionnées dans une seule colonne id attributes 101 {‘SKU’: ’99_B33W’, ‘name’: ‘Blue Shoes’, ’price’: 64.99 …} 106 {‘SKU’: ’54_A23B’, ‘name’: ‘Umbrella’, ’price’: 19.99 …} 115 {‘SKU’: ’11_R22F’, ‘name’: ‘AiePhone’, ’price’: 45.55 …} 132 {‘SKU’: ’98_N26T’, ‘name’: ‘Chair’, ’price’: 63 …} SKU name price stock color 99_B33W Blue Shoes 64.99 6 blue 54_A23B Umbrella 19.99 55 black 11_R22F AiePhone 45.55 1200 white 98_N26T Chair 63.00 8 null
  • 29. TRIGGERS D’INDEXATION 29 catalog_198 id_catalog mapping 198 {‘id’: ‘SKU’, ‘prix’: ‘price’, ‘titre’: ‘name’, … } catalog_format CREATE TRIGGER xxx after INSERT OR UPDATE OF mapping ON catalog_format id attributes 101 {‘SKU’: ’99_B33W’, ‘name’: ‘Blue Shoes’, ’price’: 64.99 …} 106 {‘SKU’: ’54_A23B’, ‘name’: ‘Umbrella’, ’price’: 19.99 …} 115 {‘SKU’: ’11_R22F’, ‘name’: ‘AiePhone’, ’price’: 45.55 …} 132 {‘SKU’: ’98_N26T’, ‘name’: ‘Chair’, ’price’: 63 …} create index on catalog_198 using btree(attributes->>’SKU’)
  • 30. TRIGGERS D’INDEXATION 30 create index on catalog_198 using GIN (attributes) Va indexer toutes les propriétés d’un produit, trop volumineux et coûteux SELECT attributes FROM catalog_198 WHERE attributes @> ’{"SKU”: "54_A23B”}’ catalog_198 id attributes 101 {‘SKU’: ’99_B33W’, ‘name’: ‘Blue Shoes’, ’price’: 64.99 …} 106 {‘SKU’: ’54_A23B’, ‘name’: ‘Umbrella’, ’price’: 19.99 …} 115 {‘SKU’: ’11_R22F’, ‘name’: ‘AiePhone’, ’price’: 45.55 …} 132 {‘SKU’: ’98_N26T’, ‘name’: ‘Chair’, ’price’: 63 …}
  • 32. PROJETS FUTURS ▸Création d'index asynchrone avec PGQ ▹Ne pas bloquer lors du changement de mapping d’un catalogue ▸Parallélisation des requêtes sur nos 4 serveurs (Citus DB ?) ▹Chaque serveur peut scanner ¼ de la table ▸TABLESAMPLE + cache ▹Estimer très rapidement un résultat sur un échantillon, puis lancer le calcul complet qui sera mis en cache 32
  • 33. MERCI MERCI Des questions ? Contact :  mickael.le.baillif@gmail.com  guillaume.stoffer@gmail.com